home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

flake.nix (8017B)


      1 {
      2   description = "System Config";
      3 
      4   outputs = { self, ... } @ inputs:
      5     let
      6       wayland = { pkgs, config, ... }: {
      7         config = {
      8           nix = {
      9             settings = {
     10               # add binary caches
     11               trusted-public-keys = [
     12                 "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
     13                 "chapeau-rouge.cachix.org-1:r34IG766Ez4Eeanr7Zx+egzXLE2Zgvc+XRspYZPDAn8="
     14                 "vdemeester.cachix.org-1:eZWNOrLR9A9szeMahn9ENaoT9DB3WgOos8va+d2CU44="
     15               ];
     16               substituters = [
     17                 "https://nixpkgs-wayland.cachix.org"
     18                 "https://chapeau-rouge.cachix.org"
     19                 "https://vdemeester.cachix.org"
     20               ];
     21             };
     22           };
     23 
     24           nixpkgs.overlays = [ inputs.nixpkgs-wayland.overlay ];
     25         };
     26       };
     27       stableModules = [
     28         inputs.home-manager-24_05.nixosModules.home-manager
     29       ];
     30       unstableModules = [
     31         inputs.home-manager.nixosModules.home-manager
     32       ];
     33       commonModules = [
     34         {
     35           config.nixpkgs.overlays = [
     36             (import ./nix/overlays).tekton
     37             (import ./nix/overlays/sbr.nix)
     38             inputs.emacs-overlay.overlay
     39             # inputs.nur.overlay
     40             # inputs.devshell.overlays.default
     41             inputs.chapeau-rouge.overlays.openshift
     42             inputs.chick-group.overlays.default
     43             (_: prev: {
     44               inherit (inputs.devenv.packages.${prev.system}) devenv;
     45               inherit (inputs.buildkit-tekton.packages.${prev.system}) tkn-local;
     46 	      inherit (inputs.dagger.packages.${prev.system}) dagger;
     47             })
     48           ];
     49         }
     50         ./systems/modules/core/default.nix
     51         ./systems/modules/shell/default.nix
     52         ./systems/modules/desktop/default.nix
     53         ./systems/modules/dev/default.nix
     54         ./systems/modules/editors/default.nix
     55         ./systems/modules/hardware/default.nix
     56 	./systems/modules/profiles/default.nix
     57         ./systems/modules/virtualisation/default.nix
     58         ./systems/modules/virtualisation/buildkit.nix
     59         ./systems/modules/services/default.nix
     60         inputs.sops-nix.nixosModules.sops
     61         # inputs.envfs.nixosModules.envfs
     62         {
     63           # config.nix.generateRegistryFromInputs = true;
     64           config.home-manager.useGlobalPkgs = true;
     65           config.home-manager.useUserPackages = true;
     66           # Import custom home-manager modules (NixOS)
     67           config.home-manager.sharedModules = import ./users/modules/modules.nix;
     68           # Default SopsFile
     69           config.sops.defaultSopsFile = ./secrets/secrets.yaml;
     70         }
     71       ];
     72     in
     73     {
     74       images = {
     75         athena = (self.nixosConfigurations.athena.extendModules {
     76           modules = [
     77             "${inputs.nixpkgs-24_05}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
     78           ];
     79         }).config.system.build.sdImage;
     80         demeter = (self.nixosConfigurations.demeter.extendModules {
     81           modules = [
     82             "${inputs.nixpkgs-24_05}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
     83           ];
     84         }).config.system.build.sdImage;
     85       };
     86       nixosConfigurations =
     87         {
     88           # Work laptop (unstable)
     89           wakasu = inputs.nixpkgs.lib.nixosSystem {
     90             system = "x86_64-linux";
     91             modules = commonModules ++ unstableModules ++ [
     92               wayland
     93               inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen
     94               ./systems/hosts/wakasu.nix
     95             ];
     96           };
     97           # Servers (stable)
     98           aomi = inputs.nixpkgs-24_05.lib.nixosSystem {
     99             system = "x86_64-linux";
    100             modules = commonModules ++ stableModules ++ [
    101               inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p1-gen3
    102               inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
    103               ./systems/hosts/aomi.nix
    104             ];
    105           };
    106           shikoku = inputs.nixpkgs-24_05.lib.nixosSystem {
    107             system = "x86_64-linux";
    108             modules = commonModules ++ stableModules ++ [
    109               ./systems/hosts/shikoku.nix
    110             ];
    111           };
    112           sakhalin = inputs.nixpkgs-24_05.lib.nixosSystem {
    113             system = "x86_64-linux";
    114             modules = commonModules ++ stableModules ++ [
    115               inputs.nixos-hardware.nixosModules.common-pc-ssd
    116               ./systems/hosts/sakhalin.nix
    117             ];
    118           };
    119           kerkouane = inputs.nixpkgs-24_05.lib.nixosSystem {
    120             system = "x86_64-linux";
    121             modules = commonModules ++ stableModules ++ [
    122               ./systems/modules/services/govanityurl.nix
    123               ./systems/hosts/kerkouane.nix
    124             ];
    125           };
    126           # Raspberry PI
    127           # athena
    128           athena = inputs.nixpkgs-24_05.lib.nixosSystem {
    129             system = "aarch64-linux";
    130             modules = commonModules ++ stableModules ++ [
    131               ./systems/hosts/athena.nix
    132             ];
    133           };
    134           # demeter
    135           demeter = inputs.nixpkgs-24_05.lib.nixosSystem {
    136             system = "aarch64-linux";
    137             modules = commonModules ++ stableModules ++ [
    138               ./systems/hosts/demeter.nix
    139             ];
    140           };
    141         };
    142 
    143       # TODO: expose some packages ?
    144       # This is probably not gonna happen, instead I should move any internal package here outside, in their
    145       # own repository and flake. If they are useful upstream.
    146 
    147       overlays = import ./nix/overlays;
    148 
    149       devShells.x86_64-linux.default =
    150         let
    151           pkgs = import inputs.nixpkgs {
    152             system = "x86_64-linux";
    153             config.allowUnfree = true;
    154           };
    155         in
    156         pkgs.mkShell {
    157           packages = [ pkgs.alejandra pkgs.git pkgs.nodePackages.prettier pkgs.deadnix pkgs.nixfmt-classic pkgs.sops ];
    158           name = "home";
    159           DIRENV_LOG_FORMAT = "";
    160         };
    161     };
    162 
    163   inputs = {
    164     # Flake for compatibility with non-flake commands
    165     flake-compat = { type = "github"; owner = "edolstra"; repo = "flake-compat"; flake = false; };
    166 
    167     devenv = {
    168       url = "github:cachix/devenv/latest";
    169       inputs.nixpkgs.follows = "nixpkgs";
    170     };
    171     buildkit-tekton = { url = "github:vdemeester/buildkit-tekton"; inputs.nixpkgs.follows = "nixpkgs"; };
    172 
    173 
    174     # nixpkgs
    175     nixpkgs = { type = "github"; owner = "NixOS"; repo = "nixpkgs"; ref = "nixos-unstable"; };
    176     nixpkgs-24_05 = { type = "github"; owner = "NixOS"; repo = "nixpkgs"; ref = "nixos-24.05"; };
    177     # Home Manager
    178     home-manager = { type = "github"; owner = "nix-community"; repo = "home-manager"; inputs.nixpkgs.follows = "nixpkgs"; };
    179     home-manager-24_05 = { type = "github"; owner = "nix-community"; repo = "home-manager"; ref = "release-24.05"; inputs.nixpkgs.follows = "nixpkgs-24_05"; };
    180 
    181     impermanence = { type = "github"; owner = "nix-community"; repo = "impermanence"; };
    182 
    183     nixpkgs-wayland = { type = "github"; owner = "nix-community"; repo = "nixpkgs-wayland"; inputs.nixpkgs.follows = "nixpkgs"; };
    184     dagger = { type = "github"; owner = "dagger"; repo = "nix"; inputs.nixpkgs.follows = "nixpkgs"; };
    185 
    186     emacs-overlay = {
    187       url = "github:nix-community/emacs-overlay";
    188       inputs.nixpkgs.follows = "nixpkgs";
    189       inputs.nixpkgs-stable.follows = "nixpkgs-24_05";
    190     };
    191 
    192     sops-nix = {
    193       type = "github";
    194       owner = "Mic92";
    195       repo = "sops-nix";
    196       inputs.nixpkgs.follows = "nixpkgs";
    197     };
    198 
    199     # WSL
    200     nixos-wsl = { type = "github"; owner = "nix-community"; repo = "NixOS-WSL"; inputs.nixpkgs.follows = "nixpkgs"; };
    201     nixos-hardware = { type = "github"; owner = "NixOS"; "repo" = "nixos-hardware"; };
    202 
    203     # Me :D
    204     chick-group = {
    205       type = "github";
    206       owner = "vdemeester";
    207       repo = "chick-group";
    208       inputs.nixpkgs.follows = "nixpkgs";
    209     };
    210     # Red Hat
    211     chapeau-rouge = {
    212       type = "github";
    213       owner = "vdemeester";
    214       repo = "chapeau-rouge";
    215       inputs.nixpkgs.follows = "nixpkgs";
    216     };
    217   };
    218 }