Nix Flakes configuration for MacOS, NixOS and WSL
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: update njord and base suite

cosmeak d16a4264 829f4ef9

+144 -136
+16 -16
flake.lock
··· 39 39 }, 40 40 "hardware": { 41 41 "locked": { 42 - "lastModified": 1751432711, 43 - "narHash": "sha256-136MeWtckSHTN9Z2WRNRdZ8oRP3vyx3L8UxeBYE+J9w=", 42 + "lastModified": 1752048960, 43 + "narHash": "sha256-gATnkOe37eeVwKKYCsL+OnS2gU4MmLuZFzzWCtaKLI8=", 44 44 "owner": "NixOS", 45 45 "repo": "nixos-hardware", 46 - "rev": "497ae1357f1ac97f1aea31a4cb74ad0d534ef41f", 46 + "rev": "7ced9122cff2163c6a0212b8d1ec8c33a1660806", 47 47 "type": "github" 48 48 }, 49 49 "original": { ··· 61 61 ] 62 62 }, 63 63 "locked": { 64 - "lastModified": 1751529406, 65 - "narHash": "sha256-jwKDHyUycp678zDYa5Hyfq3msO73YMXdZPxp96dU7po=", 64 + "lastModified": 1752052164, 65 + "narHash": "sha256-rq5aT1acTwLMAds//7WLtZhZGC5Hyr5YQqbiA0kb3yo=", 66 66 "owner": "Jovian-Experiments", 67 67 "repo": "Jovian-NixOS", 68 - "rev": "b2e5ce654e4f5bf8905c2e07a96dcf4966e6277d", 68 + "rev": "f81c48f403c976463fe5812e9e6bca8cf49aebdc", 69 69 "type": "github" 70 70 }, 71 71 "original": { ··· 98 98 }, 99 99 "nixpkgs": { 100 100 "locked": { 101 - "lastModified": 1751479989, 102 - "narHash": "sha256-M5KgdpVBVcW4HRVq9/OSRbrxlwsQ1ogEKqnvzsClDqU=", 101 + "lastModified": 1751943650, 102 + "narHash": "sha256-7orTnNqkGGru8Je6Un6mq1T8YVVU/O5kyW4+f9C1mZQ=", 103 103 "owner": "nixos", 104 104 "repo": "nixpkgs", 105 - "rev": "34627c90f062da515ea358360f448da57769236e", 105 + "rev": "88983d4b665fb491861005137ce2b11a9f89f203", 106 106 "type": "github" 107 107 }, 108 108 "original": { ··· 114 114 }, 115 115 "nixpkgs_2": { 116 116 "locked": { 117 - "lastModified": 1749173751, 118 - "narHash": "sha256-ENY3y3v6S9ZmLDDLI3LUT8MXmfXg/fSt2eA4GCnMVCE=", 117 + "lastModified": 1751792365, 118 + "narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", 119 119 "owner": "NixOS", 120 120 "repo": "nixpkgs", 121 - "rev": "ed29f002b6d6e5e7e32590deb065c34a31dc3e91", 121 + "rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", 122 122 "type": "github" 123 123 }, 124 124 "original": { 125 125 "owner": "NixOS", 126 - "ref": "nixos-24.11", 126 + "ref": "nixos-unstable", 127 127 "repo": "nixpkgs", 128 128 "type": "github" 129 129 } ··· 143 143 "nixpkgs": "nixpkgs_2" 144 144 }, 145 145 "locked": { 146 - "lastModified": 1749574455, 147 - "narHash": "sha256-fm2/8KPOYvvIAnNVtjDlTt/My00lIbZQ+LMrfQIWVzs=", 146 + "lastModified": 1752175848, 147 + "narHash": "sha256-W0zBGYOdPdVs3Y1iSxvUdBQvM3jftxv/oGcgrMLvowQ=", 148 148 "owner": "nix-community", 149 149 "repo": "NixOS-WSL", 150 - "rev": "917af390377c573932d84b5e31dd9f2c1b5c0f09", 150 + "rev": "0fa96ff0e161a7daae530b108948070ff3a49ddf", 151 151 "type": "github" 152 152 }, 153 153 "original": {
+6 -20
flake.nix
··· 35 35 36 36 outputs = { self, nixpkgs, ... }@inputs : 37 37 let 38 - # Custom modules 39 - nixosModules = [ 40 - ./modules/nixos/hardware/nvidia.nix 41 - ./modules/nixos/hardware/audio.nix 42 - ./modules/nixos/programs/steam.nix 43 - ./modules/nixos/system/auto-update.nix 44 - ./modules/nixos/system/garbage-collector.nix 45 - ./modules/common/suites/base.nix 46 - ./modules/common/suites/development.nix 47 - ./modules/common/suites/pentesting.nix 48 - ]; 49 - 50 - darwinModules = [ 51 - ./modules/darwin/system/garbage-collector.nix 52 - ./modules/common/suites/base.nix 53 - ./modules/common/suites/development.nix 54 - ]; 38 + lib = import ./lib { inherit self inputs; }; 55 39 56 - # Methods 57 - forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 40 + # Modules 41 + common = lib.fs.getFilesRecursively ./modules/common; 42 + nixosModules = lib.fs.getFilesRecursively ./modules/nixos ++ common; 43 + darwinModules = lib.fs.getFilesRecursively ./modules/darwin ++ common; 58 44 in { 59 45 # Nixos Configurations 60 46 nixosConfigurations = { ··· 113 99 }; 114 100 115 101 # Development shells 116 - devShells = forAllSystems(system: 102 + devShells = lib.forAllSystems(system: 117 103 let 118 104 pkgs = import nixpkgs { inherit system; }; 119 105 in
lib/.gitkeep modules/darwin/.gitkeep
+6
lib/default.nix
··· 1 + ## Custom library built on top of nix lib 2 + { self, inputs, ... }: 3 + { 4 + forAllSystems = inputs.nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 5 + fs = import ./fs.nix { inherit self inputs; }; 6 + }
+30
lib/fs.nix
··· 1 + ## FileSystem 2 + ## Help manage file and access to it 3 + { self, inputs, ... }: 4 + 5 + let inherit (inputs.nixpkgs) lib; in 6 + 7 + rec { 8 + ## Match if type is a directory 9 + #@ String -> Boolean 10 + isDirectory = type: type == "directory"; 11 + 12 + ## Match if type is a file 13 + #@ String -> Boolean 14 + isFile = type: type == "regular"; 15 + 16 + ## Get files in all folders at a giver path 17 + #@ Path -> []Path 18 + getFilesRecursively = path: let 19 + entries = builtins.readDir path |> lib.filterAttrs (name: type: (type |> isDirectory) || (type |> isFile)); 20 + mapFile = name: type: let 21 + path' = "${path}/${name}"; 22 + in 23 + if type |> isDirectory 24 + then getFilesRecursively path' 25 + else if name |> lib.hasSuffix ".nix" 26 + then path' 27 + else []; 28 + files = lib.flatten (lib.mapAttrsToList mapFile entries); 29 + in files; 30 + }
+6 -12
machines/darwin/njord/default.nix
··· 17 17 18 18 # System wide packages 19 19 environment.systemPackages = with pkgs; [ 20 - librewolf # web browser 21 - firefox # to delete -> will be replace by librewolf with custom css and extensions 22 - spotify # music 23 - stats # System monitoring displayed in macos top bar - will be replaced by custom script with sketchybar 24 - raycast # replacement for spotlight 25 - alt-tab-macos # alt tab like windows on macos 26 - utm # VM emulator for macos/ios 27 - cocoapods # used for swift development 28 - obsidian # Markdown note taking app 29 - zed-editor # code editor 30 - # desmume # Nintendo DS emulator - not working on aarch64-darwin because required alsa audio for build 20 + stats # System monitoring displayed in macos top bar - will be replaced by custom script with sketchybar 21 + raycast # replacement for spotlight 22 + alt-tab-macos # alt tab like windows on macos 31 23 ]; 32 24 33 - programs._1password.enable = true; # Password manager (come from nix-darwin modules) 25 + programs._1password.enable = true; # Password manager 34 26 27 + # Complete suite for a specific purpose reused by multiple machines/users 28 + asgard.suites.base.enable = true; 35 29 asgard.suites.development.enable = true; 36 30 37 31 # Linux builder
+3 -6
machines/darwin/njord/homebrew/casks.nix
··· 1 1 { 2 + # If something is here, it's either not available in nixpkgs or broken 2 3 homebrew.casks = [ 3 - "orbstack" # Replace docker desktop -> will be replace with podman? 4 4 "figma" # ux/ui 5 - "amethyst" # Window manager (to package) 6 - "font-hack-nerd-font" # move this to nix installation 7 - "discord" # use this one since nixpkgs doesn't have krisp 8 - # "logitech-g-hub" # Error when trying to install it 9 - "ghostty" # terminal emulator 5 + "amethyst" # Window manager (to package for nix) 6 + # "logitech-g-hub" #! Error when trying to install it 10 7 "balenaetcher" # image flasher 11 8 "desmume" # Nintendo DS emulator 12 9 ];
+1 -1
machines/nixos/loki/default.nix
··· 48 48 services.xserver.displayManager.lightdm.enable = true; 49 49 services.displayManager.defaultSession = "budgie-desktop"; 50 50 environment.budgie.excludePackages = with pkgs; [ 51 - mate.mate-terminal # don't need since we have kitty installed 51 + mate.mate-terminal # don't need since we have ghostty installed 52 52 ]; 53 53 54 54 # Global packages
+22 -6
modules/common/suites/base.nix
··· 7 7 enable = lib.mkEnableOption "Enable the base suite."; 8 8 }; 9 9 10 + # collection of opiniated package to use as a base 10 11 config = lib.mkIf cfg.enable ({ 11 - # collection of opiniated package for a workstation 12 + # ┌───────────────────────────────┐ 13 + # │ Global | 14 + # └───────────────────────────────┘ 12 15 environment.systemPackages = with pkgs; [ 13 - librewolf # web browser 14 - obsidian # markdown note taking app 15 - discord # chat app 16 - ghostty # terminal emulator 17 - spotify # music library 16 + librewolf # web browser 17 + obsidian # markdown note taking app 18 + spotify # music library 19 + ] 20 + # ┌───────────────────────────────┐ 21 + # │ Linux Only | 22 + # └───────────────────────────────┘ 23 + ++ lib.optionals (pkgs.stdenv.isLinux) [ 24 + discord # chat app | not use this one for darwin because it's not containing Krisp 25 + ghostty # terminal emulator | marked as broken for darwin 26 + ]; 27 + # ┌───────────────────────────────┐ 28 + # │ Darwin Only | 29 + # └───────────────────────────────┘ 30 + } // lib.mkIf pkgs.stdenv.isDarwin { 31 + homebrew.casks = [ 32 + "discord" 33 + "ghostty" 18 34 ]; 19 35 }); 20 36 }
+3 -2
modules/common/suites/development.nix
··· 9 9 10 10 config = lib.mkIf cfg.enable ({ 11 11 environment.systemPackages = with pkgs; [ 12 - vscodium # gui editor - vscode without telemetry 13 - helix # modal editor 12 + zed-editor # gui code editor 13 + helix # modal code editor 14 14 bruno # ide for testing apis 15 15 dbeaver-bin # database client 16 16 git # versionning tool 17 17 lazygit # git tui helper 18 + docker # container tool -> replacement of docker 18 19 ]; 19 20 }); 20 21 }
modules/common/suites/gaming.nix modules/nixos/suites/gaming.nix
-17
modules/common/suites/pentesting.nix
··· 1 - { config, pkgs, lib, ... }: 2 - let 3 - cfg = config.asgard.suites.pentesting; 4 - in 5 - { 6 - options.asgard.suites.pentesting = { 7 - enable = lib.mkEnableOption "Enable the pentesting suite."; 8 - }; 9 - 10 - config = lib.mkIf cfg.enable ({ 11 - environment.systemPackages = with pkgs; [ 12 - nmap 13 - sqlmap 14 - burpsuite 15 - ]; 16 - }); 17 - }
+36
modules/common/system/garbage-collector.nix
··· 1 + { config, pkgs, lib, ... }: 2 + let 3 + cfg = config.asgard.system.garbageCollector; 4 + in 5 + { 6 + options.asgard.system.garbageCollector = { 7 + enable = lib.mkEnableOption "garbage collection."; 8 + }; 9 + 10 + # Perform garbage collection weekly to maintain low disk usage 11 + config = lib.mkIf cfg.enable (lib.mkMerge [ 12 + # ┌───────────────────────────────┐ 13 + # │ Linux Only | 14 + # └───────────────────────────────┘ 15 + (lib.mkIf pkgs.stdenv.isLinux { 16 + nix.settings.auto-optimise-store = true; 17 + nix.gc = { 18 + automatic = true; 19 + dates = "weekly"; 20 + options = "--delete-older-than 1w"; 21 + }; 22 + }) 23 + 24 + # ┌───────────────────────────────┐ 25 + # │ Darwin Only | 26 + # └───────────────────────────────┘ 27 + (lib.mkIf pkgs.stdenv.isDarwin { 28 + nix.gc = { 29 + automatic = true; 30 + interval = [{ Weekday = 7; }]; 31 + options = "--delete-older-than 7d"; 32 + }; 33 + nix.optimise.automatic = true; 34 + }) 35 + ]); 36 + }
-19
modules/darwin/system/garbage-collector.nix
··· 1 - { config, pkgs, lib, ... }: 2 - let 3 - cfg = config.asgard.system.garbageCollector; 4 - in 5 - { 6 - options.asgard.system.garbageCollector = { 7 - enable = lib.mkEnableOption "Enable garbage collection."; 8 - }; 9 - 10 - config = lib.mkIf cfg.enable ({ 11 - # Perform garbage collection weekly to maintain low disk usage 12 - nix.gc = { 13 - automatic = true; 14 - interval = [{ Weekday = 7; }]; 15 - options = "--delete-older-than 7d"; 16 - }; 17 - nix.optimise.automatic = true; 18 - }); 19 - }
+15 -12
modules/nixos/system/auto-update.nix
··· 8 8 }; 9 9 10 10 config = lib.mkIf cfg.enable ({ 11 - system.autoUpgrade = { 12 - enable = true; 13 - flake = "/etc/nixos\\?submodules=1"; 14 - flags = [ 15 - "--update-input" 16 - "nixpkgs" 17 - "-L" 18 - ]; 19 - dates = "Sat *-*-* 06:00:00"; 20 - randomizedDelaySec = "45min"; 21 - allowReboot = true; 22 - }; 11 + # TODO: review this to make it work with auto turn on, update, 12 + # commit, push and then shutdown. 13 + 14 + # system.autoUpgrade = { 15 + # enable = true; 16 + # flake = "/etc/nixos\\?submodules=1"; 17 + # flags = [ 18 + # "--update-input" 19 + # "nixpkgs" 20 + # "-L" 21 + # ]; 22 + # dates = "Sat *-*-* 06:00:00"; 23 + # randomizedDelaySec = "45min"; 24 + # allowReboot = true; 25 + # }; 23 26 }); 24 27 }
-25
modules/nixos/system/garbage-collector.nix
··· 1 - { config, pkgs, lib, ... }: 2 - let 3 - cfg = config.asgard.system.garbageCollector; 4 - in 5 - { 6 - options.asgard.system.garbageCollector = { 7 - enable = lib.mkEnableOption "garbage collection."; 8 - }; 9 - 10 - config = lib.mkIf cfg.enable ({ 11 - # Perform garbage collection weekly to maintain low disk usage 12 - nix.gc = { 13 - automatic = true; 14 - dates = "weekly"; 15 - options = "--delete-older-than 1w"; 16 - }; 17 - 18 - # Optimize storage 19 - # You can also manually optimize the store via: 20 - # nix-store --optimise 21 - # Refer to the following link for more details: 22 - # https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store 23 - nix.settings.auto-optimise-store = true; 24 - }); 25 - }