aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 862736e6a0faa94a04de218a2ac22ce4a9e1e24c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
{
  description = "Mora Unie Youer's NixOS configuration";

  # This section is hugely uses "input reusing" so that there will be no copies
  # of the same repository on flake update
  # NOTE: unless it is needed :wink:
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs-pinned.url = "github:NixOS/nixpkgs/4fb937aabc3321e28d8bfe444d781afad09e0951";

    nix-filter.url = "github:numtide/nix-filter";

    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };

    flake-utils.url = "github:numtide/flake-utils";

    flake-parts = {
      url = "github:hercules-ci/flake-parts";
      inputs.nixpkgs-lib.follows = "nixpkgs";
    };

    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nurpkgs = {
      url = "github:nix-community/NUR";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-parts.follows = "flake-parts";
    };

    nyxpkgs = {
      url = "github:chaotic-cx/nyx";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.home-manager.follows = "home-manager";
    };

    # Secure Boot bootloader
    lanzaboote = {
      url = "github:nix-community/lanzaboote";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-compat.follows = "flake-compat";
      inputs.flake-parts.follows = "flake-parts";
      inputs.rust-overlay.follows = "rust-overlay";
    };

    # Setup NixOS sound subsystem better
    musnix = {
      url = "github:musnix/musnix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Applications
    astal = {
      url = "github:Aylur/astal";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    aylurs-gtk-shell = {
      url = "github:Aylur/ags";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.astal.follows = "astal";
    };

    fjordlauncher = {
      url = "github:unmojang/FjordLauncher";
      # NOTE: re-following inputs breaks Cachix
      #inputs.nixpkgs.follows = "nixpkgs";
      #inputs.nix-filter.follows = "nix-filter";
      #inputs.flake-compat.follows = "flake-compat";
    };

    niri = {
      # NOTE: using this repo to use cachix binaries
      url = "github:sodiboo/niri-flake";

      # url = "github:YaLTeR/niri";
      # inputs.nixpkgs.follows = "nixpkgs";
      # inputs.nix-filter.follows = "nix-filter";
      # inputs.rust-overlay.follows = ""; # NOTE: for end user is not requried
    };

    wezterm = {
      url = "github:wezterm/wezterm?dir=nix";
      # NOTE: re-following inputs breaks Cachix
      #inputs.nixpkgs.follows = "nixpkgs";
      #inputs.flake-utils.follows = "flake-utils";
      #inputs.rust-overlay.follows = "rust-overlay";
    };

    # NOTE: re-following inputs breaks Cachix
    neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";

    neovim-configuration = {
      url = "git+https://git.140041.xyz/neovim-configuration";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.neovim-nightly-overlay.follows = "neovim-nightly-overlay";
    };
  };

  nixConfig = {
    extra-substituters = [
      # NOTE: Some of the cachix repositories do not work for some reason :^(
      "https://nix-community.cachix.org"
      "https://chaotic-nyx.cachix.org"
      "https://unmojang.cachix.org"
      "https://wezterm.cachix.org"
      "https://niri.cachix.org"
      "https://neovim-nightly.cachix.org"
    ];

    extra-trusted-public-keys = [
      # NOTE: Some of the cachix repositories do not work for some reason :^(
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      "chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8="
      "unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
      "wezterm.cachix.org-1:kAbhjYUC9qvblTE+s7S+kl5XM1zVa4skO+E/1IDWdH0="
      "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964="
      "neovim-nightly.cachix.org-1:feIoInHRevVEplgdZvQDjhp11kYASYCE2NGY9hNrwxY="
    ];
  };

  outputs =
    {
      self,

      nixpkgs,
      nurpkgs,
      nyxpkgs,
      home-manager,

      lanzaboote,

      musnix,

      fjordlauncher,
      niri,
      wezterm,

      neovim-configuration,

      ...
    }@inputs:
    let
      system = "x86_64-linux";
    in
    {
      nixosConfigurations.sapphire = nixpkgs.lib.nixosSystem rec {
        inherit system;
        specialArgs = { inherit inputs; };

        modules = [
          nurpkgs.modules.nixos.default
          nyxpkgs.nixosModules.default
          home-manager.nixosModules.home-manager

          lanzaboote.nixosModules.lanzaboote

          musnix.nixosModules.default

          {
            nixpkgs.overlays = [
              fjordlauncher.overlays.default
              niri.overlays.niri
            ];
          }

          {
            nix.trustedUsers = [
              "root"
              "mora"
            ];
          }

          # System Configuration
          ./system-sapphire.nix
          neovim-configuration.nixosModules.default

          # User Configurations
          # mora@sapphire
          (
            { pkgs, ... }:
            {
              users.users.mora = {
                isNormalUser = true;
                extraGroups = [
                  "audio"
                  "docker"
                  "libvirtd"
                  "lp"
                  "scanner"
                  "video"
                  "wireshark"
                  "wheel"
                ];
                shell = pkgs.nushell;
              };

              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;
              home-manager.extraSpecialArgs = specialArgs;
              home-manager.users.mora = import ./user-mora.nix;
            }
          )
        ];
      };
    };
}