grace/dots

dotfiles/nix configs

git clone https://git.gae.moe/grace/dots

Grace Yoderlovelace updates0e83893

main
3.4 KiB123 linesraw
1{
2  description = "my awesome and cool flake";
3
4  inputs = {
5    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6    darwin = {
7      url = "github:nix-darwin/nix-darwin";
8      inputs.nixpkgs.follows = "nixpkgs";
9    };
10    home-manager = {
11      url = "github:nix-community/home-manager";
12      inputs.nixpkgs.follows = "nixpkgs";
13    };
14    sops-nix = {
15      url = "github:Mic92/sops-nix";
16      inputs.nixpkgs.follows = "nixpkgs";
17    };
18    tpb = {
19      url = "git+https://git.gae.moe/grace/tpb.git?ref=refs/tags/0.1.4";
20      # flake = false;
21    };
22    sorcery.url = "git+https://git.gae.moe/forks/sorcery?ref=refs/heads/grace-patches";
23    zen-browser = {
24      url = "github:0xc000022070/zen-browser-flake";
25      inputs.nixpkgs.follows = "nixpkgs";
26    };
27  };
28
29  outputs =
30    inputs@{ self, nixpkgs, ... }:
31    let
32      inherit (nixpkgs) lib;
33      hosts = import ./hosts.nix;
34      hostsOfType = type: lib.filterAttrs (_: host: host.type == type) hosts;
35      systems = lib.unique (map (host: host.system) (builtins.attrValues hosts));
36      hostArgs = name: {
37        inherit inputs;
38        host = hosts.${name} // {
39          inherit name;
40        };
41      };
42    in
43    {
44      darwinConfigurations = lib.mapAttrs (
45        name: _:
46        inputs.darwin.lib.darwinSystem {
47          specialArgs = hostArgs name;
48          modules = [ (./hosts + "/${name}.nix") ];
49        }
50      ) (hostsOfType "darwin");
51
52      nixosConfigurations = lib.mapAttrs (
53        name: _:
54        lib.nixosSystem {
55          specialArgs = hostArgs name;
56          modules = [ (./hosts + "/${name}.nix") ];
57        }
58      ) (hostsOfType "nixos");
59
60      homeConfigurations = lib.mapAttrs (
61        name: host:
62        inputs.home-manager.lib.homeManagerConfiguration {
63          extraSpecialArgs = hostArgs name;
64          pkgs = import nixpkgs {
65            system = host.system;
66            config.allowUnfree = true;
67          };
68          modules = [ (./hosts + "/${name}.nix") ];
69        }
70      ) (hostsOfType "home");
71
72      packages.x86_64-linux.portable-iso =
73        (lib.nixosSystem {
74          specialArgs = hostArgs "portable";
75          modules = [ ./iso.nix ];
76        }).config.system.build.isoImage;
77      packages.x86_64-linux.portable-usb = self.nixosConfigurations.portable.config.system.build.usbImage;
78
79      devShells = lib.genAttrs systems (
80        system:
81        let
82          pkgs = import nixpkgs { inherit system; };
83        in
84        {
85          default = pkgs.mkShellNoCC {
86            packages =
87              (with pkgs; [
88                lixPackageSets.stable.lix
89                nixos-rebuild-ng
90                coreutils
91                openssh
92                git
93                jujutsu
94                jq
95                nixfmt
96                age
97                fish
98                gnupg
99                gitleaks
100                helix
101                just
102                sops
103                ssh-to-age
104                (python3.withPackages (p: [ p.pyyaml ]))
105              ])
106              ++ [ inputs.home-manager.packages.${system}.home-manager ]
107              ++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
108                inputs.darwin.packages.${system}.darwin-rebuild
109              ];
110
111            EDITOR = "hx";
112
113            shellHook = ''
114              if [[ $- == *i* ]]; then
115                export SHELL=${pkgs.fish}/bin/fish
116                exec "$SHELL"
117              fi
118            '';
119          };
120        }
121      );
122    };
123}