nixos-dots

nixos dots
git clone git://popovic.xyz/nixos-dots.git
Log | Files | Refs

flake.nix (7592B)


      1 {
      2   description = "NixOS";
      3   inputs = {
      4     nixpkgs_stable.url = "nixpkgs/nixos-25.11";
      5     nixpkgs.url = "nixpkgs/nixos-unstable";
      6 
      7     nix-darwin.url = "github:nix-darwin/nix-darwin/master";
      8     nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
      9 
     10     nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
     11     nixos-hardware.url = "github:NixOS/nixos-hardware";
     12 
     13     niri.url = "github:sodiboo/niri-flake";
     14     noctalia.url = "github:noctalia-dev/noctalia-shell";
     15 
     16     betterfox.url = "github:HeitorAugustoLN/betterfox-nix";
     17 
     18     sops-nix = {
     19       url = "github:Mic92/sops-nix";
     20       inputs.nixpkgs.follows = "nixpkgs";
     21     };
     22 
     23     home-manager = {
     24       url = "github:nix-community/home-manager";
     25       inputs.nixpkgs.follows = "nixpkgs";
     26     };
     27 
     28     disko = {
     29       url = "github:nix-community/disko";
     30       inputs.nixpkgs.follows = "nixpkgs";
     31     };
     32   };
     33 
     34   outputs =
     35     {
     36       self,
     37       nixpkgs_stable,
     38       nixpkgs,
     39       nix-darwin,
     40       disko,
     41       home-manager,
     42       nixos-hardware,
     43       sops-nix,
     44       betterfox,
     45       ...
     46     }@inputs:
     47     let
     48       linuxSystem = "x86_64-linux";
     49       darwinSystem = "aarch64-darwin";
     50 
     51       pkgsLinux = nixpkgs.legacyPackages.${linuxSystem};
     52       pkgsDarwin = nixpkgs.legacyPackages.${darwinSystem};
     53 
     54       # Set at build time with: IS_WAYLAND=1 nixos-rebuild switch --flake .#host
     55       isWayland = builtins.getEnv "IS_WAYLAND" == "1";
     56     in
     57     {
     58       nixosConfigurations =
     59         let
     60           isDarwin = false;
     61         in
     62         {
     63           frame =
     64             let
     65               hostName = "frame";
     66               system = linuxSystem;
     67             in
     68             nixpkgs.lib.nixosSystem {
     69               inherit system;
     70               specialArgs = {
     71                 inherit
     72                   inputs
     73                   hostName
     74                   system
     75                   isDarwin
     76                   ;
     77               };
     78               modules = [
     79                 nixos-hardware.nixosModules.framework-13-7040-amd
     80                 home-manager.nixosModules.home-manager
     81                 sops-nix.nixosModules.sops
     82                 ./hosts/frame/configuration.nix
     83                 ./hosts/frame/hardware.nix
     84                 {
     85                   home-manager = {
     86                     useGlobalPkgs = true;
     87                     useUserPackages = true;
     88                     extraSpecialArgs = {
     89                       inherit
     90                         system
     91                         inputs
     92                         isDarwin
     93                         isWayland
     94                         ;
     95                       standalone = false;
     96                     };
     97                     users.mika = import ./users/mika.nix;
     98                   };
     99                 }
    100               ];
    101             };
    102           nixos-frame =
    103             let
    104               hostName = "nixos-frame";
    105               system = linuxSystem;
    106             in
    107             nixpkgs.lib.nixosSystem {
    108               inherit system;
    109               specialArgs = {
    110                 inherit
    111                   inputs
    112                   hostName
    113                   system
    114                   isDarwin
    115                   ;
    116               };
    117               modules = [
    118                 nixos-hardware.nixosModules.framework-13-7040-amd
    119                 home-manager.nixosModules.home-manager
    120                 sops-nix.nixosModules.sops
    121                 ./hosts/frame/configuration.nix
    122                 ./hosts/vm/hardware.nix
    123                 {
    124                   home-manager = {
    125                     useGlobalPkgs = true;
    126                     useUserPackages = true;
    127                     extraSpecialArgs = {
    128                       inherit
    129                         system
    130                         inputs
    131                         isDarwin
    132                         isWayland
    133                         ;
    134                       standalone = false;
    135                     };
    136                     users.mika = import ./users/mika.nix;
    137                   };
    138                 }
    139               ];
    140             };
    141 
    142           nixos-vm =
    143             let
    144               hostName = "nixos-vm";
    145               system = linuxSystem;
    146             in
    147             nixpkgs.lib.nixosSystem {
    148               inherit system;
    149               specialArgs = {
    150                 inherit
    151                   inputs
    152                   hostName
    153                   system
    154                   isDarwin
    155                   ;
    156               };
    157               modules = [
    158                 home-manager.nixosModules.home-manager
    159                 ./hosts/frame/configuration.nix
    160                 ./hosts/vm/hardware.nix
    161                 {
    162                   home-manager = {
    163                     useGlobalPkgs = true;
    164                     useUserPackages = true;
    165                     extraSpecialArgs = {
    166                       inherit system inputs isDarwin;
    167                       standalone = false;
    168                     };
    169                     users.mika = import ./users/mika.nix;
    170                   };
    171                 }
    172               ];
    173             };
    174 
    175           nixos-server =
    176             let
    177               hostName = "nixos-server";
    178               system = linuxSystem;
    179             in
    180             nixpkgs_stable.lib.nixosSystem {
    181               inherit system;
    182               specialArgs = {
    183                 inherit inputs hostName system;
    184               };
    185               modules = [
    186                 home-manager.nixosModules.home-manager
    187                 ./hosts/server/configuration.nix
    188                 ./hosts/server/hardware.nix
    189                 {
    190                   home-manager = {
    191                     useGlobalPkgs = true;
    192                     useUserPackages = true;
    193                     extraSpecialArgs = {
    194                       inherit system inputs;
    195                       standalone = false;
    196                     };
    197                     users.r2d2 = import ./users/r2d2.nix;
    198                   };
    199                 }
    200               ];
    201             };
    202         };
    203 
    204       darwinConfigurations = {
    205         mac =
    206           let
    207             hostName = "mac";
    208             systemName = darwinSystem;
    209             system = darwinSystem;
    210             isDarwin = true;
    211           in
    212           nix-darwin.lib.darwinSystem {
    213             specialArgs = {
    214               inherit
    215                 hostName
    216                 systemName
    217                 inputs
    218                 isDarwin
    219                 ;
    220             };
    221             modules = [
    222               home-manager.darwinModules.home-manager
    223               sops-nix.darwinModules.sops
    224               ./hosts/mac/configuration.nix
    225               {
    226                 home-manager = {
    227                   useGlobalPkgs = true;
    228                   useUserPackages = true;
    229                   extraSpecialArgs = {
    230                     inherit
    231                       system
    232                       inputs
    233                       isDarwin
    234                       isWayland
    235                       ;
    236                     standalone = false;
    237                   };
    238                   users.mika = import ./users/mika.nix;
    239                 };
    240               }
    241             ];
    242           };
    243       };
    244 
    245       homeConfigurations = {
    246         mika =
    247           let
    248             system = builtins.currentSystem;
    249             pkgs = if system == darwinSystem then pkgsDarwin else pkgsLinux;
    250             isDarwin = system == darwinSystem;
    251           in
    252           home-manager.lib.homeManagerConfiguration {
    253             inherit pkgs;
    254             modules = [ ./users/mika.nix ];
    255             extraSpecialArgs = {
    256               inherit
    257                 system
    258                 inputs
    259                 isDarwin
    260                 isWayland
    261                 ;
    262               standalone = true;
    263             };
    264           };
    265       };
    266     };
    267 }