From 5e2d3a6ce440d53f4f60085e5aa20a5bb02af3db Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 12 Mar 2024 00:24:28 +0100 Subject: [PATCH] add mpro Signed-off-by: Harald Hoyer --- flake.lock | 57 ++++++++++++- flake.nix | 21 ++++- .../default.nix | 7 -- .../x86_64-linux/harald@sgx-azure/default.nix | 1 - .../x86_64-linux/harald@sgx-nixos/default.nix | 5 +- homes/x86_64-linux/harald@sgx/default.nix | 5 +- homes/x86_64-linux/harald@x1/default.nix | 3 +- modules/darwin/home/default.nix | 40 +++++++++ modules/darwin/nix/default.nix | 74 ++++++++++++++++ modules/darwin/security/gpg/default.nix | 85 +++++++++++++++++++ .../darwin/services/nix-daemon/default.nix | 17 ++++ modules/darwin/suites/common/default.nix | 39 +++++++++ modules/darwin/suites/development/default.nix | 35 ++++++++ modules/darwin/system/fonts/default.nix | 32 +++++++ modules/darwin/system/interface/default.nix | 29 +++++++ modules/darwin/tools/flake/default.nix | 18 ++++ modules/darwin/tools/git/default.nix | 62 ++++++++++++++ modules/darwin/tools/java/default.nix | 17 ++++ modules/darwin/tools/node/default.nix | 42 +++++++++ modules/darwin/tools/python/default.nix | 22 +++++ modules/darwin/user/default.nix | 45 ++++++++++ .../home/cli-apps/home-manager/default.nix | 3 +- modules/nixos/tools/git/default.nix | 7 +- systems/x86_64-darwin/mpro/default.nix | 17 ++++ systems/x86_64-linux/sgx/default.nix | 2 +- 25 files changed, 665 insertions(+), 20 deletions(-) rename homes/x86_64-darwin/{harald@mpro.fritz.box => harald@mpro}/default.nix (80%) create mode 100644 modules/darwin/home/default.nix create mode 100644 modules/darwin/nix/default.nix create mode 100644 modules/darwin/security/gpg/default.nix create mode 100644 modules/darwin/services/nix-daemon/default.nix create mode 100644 modules/darwin/suites/common/default.nix create mode 100644 modules/darwin/suites/development/default.nix create mode 100644 modules/darwin/system/fonts/default.nix create mode 100644 modules/darwin/system/interface/default.nix create mode 100644 modules/darwin/tools/flake/default.nix create mode 100644 modules/darwin/tools/git/default.nix create mode 100644 modules/darwin/tools/java/default.nix create mode 100644 modules/darwin/tools/node/default.nix create mode 100644 modules/darwin/tools/python/default.nix create mode 100644 modules/darwin/user/default.nix create mode 100644 systems/x86_64-darwin/mpro/default.nix diff --git a/flake.lock b/flake.lock index 4de13ed..87779ed 100644 --- a/flake.lock +++ b/flake.lock @@ -305,6 +305,26 @@ "type": "github" } }, + "darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709771483, + "narHash": "sha256-Hjzu9nCknHLQvhdaRFfCEprH0o15KcaNu1QDr3J88DI=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "550340062c16d7ef8c2cc20a3d2b97bcd3c6b6f6", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "dashboard-nvim": { "flake": false, "locked": { @@ -767,6 +787,22 @@ "type": "github" } }, + "gpg-base-conf": { + "flake": false, + "locked": { + "lastModified": 1710110429, + "narHash": "sha256-sW7crQEhoGslXyO9djBuPYf1DFqTo5uYUEFkaSCw1xc=", + "owner": "drduh", + "repo": "config", + "rev": "702281406b1f491b805d8e380dc03d73ace517f3", + "type": "github" + }, + "original": { + "owner": "drduh", + "repo": "config", + "type": "github" + } + }, "highlight-undo": { "flake": false, "locked": { @@ -1972,7 +2008,9 @@ }, "root": { "inputs": { + "darwin": "darwin", "disko": "disko", + "gpg-base-conf": "gpg-base-conf", "home-manager": "home-manager", "lanzaboote": "lanzaboote", "neovim-flake": "neovim-flake", @@ -1980,7 +2018,8 @@ "nixsgx-flake": "nixsgx-flake", "snowfall-lib": "snowfall-lib_2", "sops-nix": "sops-nix", - "unstable": "unstable" + "unstable": "unstable", + "yubikey-guide": "yubikey-guide" } }, "rust-overlay": { @@ -2587,6 +2626,22 @@ "type": "github" } }, + "yubikey-guide": { + "flake": false, + "locked": { + "lastModified": 1710173432, + "narHash": "sha256-bzoO+sxhaC8P513XpxmYXhb/rRt3Qc6q65m8sn++5/s=", + "owner": "drduh", + "repo": "YubiKey-Guide", + "rev": "12b232d28fbb6ea61ccff2075751105c77ca84ee", + "type": "github" + }, + "original": { + "owner": "drduh", + "repo": "YubiKey-Guide", + "type": "github" + } + }, "zig": { "inputs": { "flake-compat": "flake-compat_2", diff --git a/flake.nix b/flake.nix index 2d1fe82..0343963 100644 --- a/flake.nix +++ b/flake.nix @@ -17,18 +17,35 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - neovim-flake.url = "github:notashelf/neovim-flake/v0.5"; - neovim-flake.inputs.nixpkgs.follows = "nixpkgs"; + # macOS Support (master) + darwin.url = "github:lnl7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + neovim-flake.url = "github:notashelf/neovim-flake/v0.5"; + neovim-flake.inputs.nixpkgs.follows = "nixpkgs"; + disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + # GPG default configuration + gpg-base-conf = { + url = "github:drduh/config"; + flake = false; + }; + + # Yubikey Guide + yubikey-guide = { + url = "github:drduh/YubiKey-Guide"; + flake = false; + }; + + nixsgx-flake = { url = "github:matter-labs/nixsgx"; # inputs.nixpkgs.follows = "nixpkgs"; diff --git a/homes/x86_64-darwin/harald@mpro.fritz.box/default.nix b/homes/x86_64-darwin/harald@mpro/default.nix similarity index 80% rename from homes/x86_64-darwin/harald@mpro.fritz.box/default.nix rename to homes/x86_64-darwin/harald@mpro/default.nix index ec02ea3..9ed2669 100644 --- a/homes/x86_64-darwin/harald@mpro.fritz.box/default.nix +++ b/homes/x86_64-darwin/harald@mpro/default.nix @@ -1,9 +1,6 @@ { lib , pkgs , config -, nixpkgs -, osConfig ? { } -, format ? "unknown" , ... }: { @@ -25,14 +22,10 @@ home-manager.enable = true; }; tools = { - git.enable = true; direnv.enable = true; alacritty.enable = true; ssh.enable = true; - # jetbrains.enable = true; }; }; - - fonts.fontconfig.enable = true; } diff --git a/homes/x86_64-linux/harald@sgx-azure/default.nix b/homes/x86_64-linux/harald@sgx-azure/default.nix index e01b032..9667487 100644 --- a/homes/x86_64-linux/harald@sgx-azure/default.nix +++ b/homes/x86_64-linux/harald@sgx-azure/default.nix @@ -1,7 +1,6 @@ { lib , pkgs , config -, nixpkgs , ... }: { diff --git a/homes/x86_64-linux/harald@sgx-nixos/default.nix b/homes/x86_64-linux/harald@sgx-nixos/default.nix index 68f018f..1c9175e 100644 --- a/homes/x86_64-linux/harald@sgx-nixos/default.nix +++ b/homes/x86_64-linux/harald@sgx-nixos/default.nix @@ -1,4 +1,7 @@ -{ config, ... }: +{ lib +, config +, ... +}: { home.sessionPath = [ "$HOME/bin" ]; diff --git a/homes/x86_64-linux/harald@sgx/default.nix b/homes/x86_64-linux/harald@sgx/default.nix index 68f018f..1c9175e 100644 --- a/homes/x86_64-linux/harald@sgx/default.nix +++ b/homes/x86_64-linux/harald@sgx/default.nix @@ -1,4 +1,7 @@ -{ config, ... }: +{ lib +, config +, ... +}: { home.sessionPath = [ "$HOME/bin" ]; diff --git a/homes/x86_64-linux/harald@x1/default.nix b/homes/x86_64-linux/harald@x1/default.nix index b56064c..c1d73cf 100644 --- a/homes/x86_64-linux/harald@x1/default.nix +++ b/homes/x86_64-linux/harald@x1/default.nix @@ -1,4 +1,5 @@ -{ config +{ lib +, config , ... }: { diff --git a/modules/darwin/home/default.nix b/modules/darwin/home/default.nix new file mode 100644 index 0000000..ccbd39e --- /dev/null +++ b/modules/darwin/home/default.nix @@ -0,0 +1,40 @@ +{ options, config, pkgs, lib, inputs, ... }: + +with lib; +with lib.plusultra; +let + cfg = config.plusultra.home; +in +{ + # imports = with inputs; [ + # home-manager.darwinModules.home-manager + # ]; + + options.plusultra.home = with types; { + file = mkOpt attrs { } + "A set of files to be managed by home-manager's ."; + configFile = mkOpt attrs { } + "A set of files to be managed by home-manager's ."; + extraOptions = mkOpt attrs { } "Options to pass directly to home-manager."; + homeConfig = mkOpt attrs { } "Final config for home-manager."; + }; + + config = { + plusultra.home.extraOptions = { + home.stateVersion = mkDefault "23.11"; + home.file = mkAliasDefinitions options.plusultra.home.file; + xdg.enable = true; + xdg.configFile = mkAliasDefinitions options.plusultra.home.configFile; + }; + + snowfallorg.users.${config.plusultra.user.name}.home.config = mkAliasDefinitions options.plusultra.home.extraOptions; + + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + + # users.${config.plusultra.user.name} = args: + # mkAliasDefinitions options.plusultra.home.extraOptions; + }; + }; +} diff --git a/modules/darwin/nix/default.nix b/modules/darwin/nix/default.nix new file mode 100644 index 0000000..995aebc --- /dev/null +++ b/modules/darwin/nix/default.nix @@ -0,0 +1,74 @@ +{ options +, config +, pkgs +, lib +, ... +}: +with lib; +with lib.plusultra; let + cfg = config.plusultra.nix; +in +{ + options.plusultra.nix = with types; { + enable = mkBoolOpt true "Whether or not to manage nix configuration."; + package = mkOpt package pkgs.nixUnstable "Which nix package to use."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + deploy-rs + nixfmt + nix-index + nix-prefetch-git + ]; + + nix = + let + users = [ "root" config.plusultra.user.name ]; + in + { + package = cfg.package; + + settings = { + experimental-features = "nix-command flakes"; + http-connections = 50; + warn-dirty = false; + log-lines = 50; + + # Large builds apparently fail due to an issue with darwin: + # https://github.com/NixOS/nix/issues/4119 + sandbox = false; + + # This appears to break on darwin + # https://github.com/NixOS/nix/issues/7273 + auto-optimise-store = false; + + allow-import-from-derivation = true; + + trusted-users = users; + allowed-users = users; + + # NOTE: This configuration is generated by nix-installer so I'm adding it here in + # case it becomes important. + extra-nix-path = "nixpkgs=flake:nixpkgs"; + build-users-group = "nixbld"; + }; + #// (lib.optionalAttrs config.plusultra.tools.direnv.enable { + # keep-outputs = true; + # keep-derivations = true; + #}); + + gc = { + automatic = true; + interval = { Day = 7; }; + options = "--delete-older-than 30d"; + user = config.plusultra.user.name; + }; + + # flake-utils-plus + generateRegistryFromInputs = true; + generateNixPathFromInputs = true; + linkInputs = true; + }; + }; +} diff --git a/modules/darwin/security/gpg/default.nix b/modules/darwin/security/gpg/default.nix new file mode 100644 index 0000000..45b11d2 --- /dev/null +++ b/modules/darwin/security/gpg/default.nix @@ -0,0 +1,85 @@ +{ lib, config, pkgs, inputs, ... }: + +let + inherit (lib) types mkEnableOption mkIf; + inherit (lib.plusultra) mkOpt; + + cfg = config.plusultra.security.gpg; + gpg = config.plusultra.security.gpg; + user = config.plusultra.user; + gpgConf = "${inputs.gpg-base-conf}/gpg.conf"; + + gpgAgentConf = '' + enable-ssh-support + default-cache-ttl 60 + max-cache-ttl 120 + ''; + + guide = "${inputs.yubikey-guide}/README.md"; + + theme = pkgs.fetchFromGitHub { + owner = "jez"; + repo = "pandoc-markdown-css-theme"; + rev = "019a4829242937761949274916022e9861ed0627"; + sha256 = "1h48yqffpaz437f3c9hfryf23r95rr319lrb3y79kxpxbc9hihxb"; + }; + + guideHTML = pkgs.runCommand "yubikey-guide" { } '' + ${pkgs.pandoc}/bin/pandoc \ + --standalone \ + --metadata title="Yubikey Guide" \ + --from markdown \ + --to html5+smart \ + --toc \ + --template ${theme}/template.html5 \ + --css ${theme}/docs/css/theme.css \ + --css ${theme}/docs/css/skylighting-solarized-theme.css \ + -o $out \ + ${guide} + ''; + + reload-yubikey = pkgs.writeShellScriptBin "reload-yubikey" '' + ${pkgs.gnupg}/bin/gpg-connect-agent "scd serialno" "learn --force" /bye + ''; +in +{ + options.plusultra.security.gpg = { + enable = mkEnableOption "GPG"; + agentTimeout = mkOpt types.int 5 "The amount of time to wait before continuing with shell init."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + gnupg + ]; + + environment.shellInit = '' + export GPG_TTY="$(tty)" + export SSH_AUTH_SOCK=$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket) + + ${pkgs.coreutils}/bin/timeout ${builtins.toString cfg.agentTimeout} ${pkgs.gnupg}/bin/gpgconf --launch gpg-agent + gpg_agent_timeout_status=$? + + if [ "$gpg_agent_timeout_status" = 124 ]; then + # Command timed out... + echo "GPG Agent timed out..." + echo 'Run "gpgconf --launch gpg-agent" to try and launch it again.' + fi + ''; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + plusultra.home.file = { + ".gnupg/.keep".text = ""; + + ".gnupg/yubikey-guide.md".source = guide; + ".gnupg/yubikey-guide.html".source = guideHTML; + + ".gnupg/gpg.conf".source = gpgConf; + ".gnupg/gpg-agent.conf".text = gpgAgentConf; + }; + }; +} diff --git a/modules/darwin/services/nix-daemon/default.nix b/modules/darwin/services/nix-daemon/default.nix new file mode 100644 index 0000000..020ea6d --- /dev/null +++ b/modules/darwin/services/nix-daemon/default.nix @@ -0,0 +1,17 @@ +{ lib, config, ... }: + +let + inherit (lib) types mkIf; + inherit (lib.plusultra) mkOpt enabled; + + cfg = config.plusultra.services.nix-daemon; +in +{ + options.plusultra.services.nix-daemon = { + enable = mkOpt types.bool true "Whether to enable the Nix daemon."; + }; + + config = mkIf cfg.enable { + services.nix-daemon = enabled; + }; +} diff --git a/modules/darwin/suites/common/default.nix b/modules/darwin/suites/common/default.nix new file mode 100644 index 0000000..29230c0 --- /dev/null +++ b/modules/darwin/suites/common/default.nix @@ -0,0 +1,39 @@ +{ options, config, lib, pkgs, ... }: + +with lib; +with lib.plusultra; +let + cfg = config.plusultra.suites.common; +in +{ + options.plusultra.suites.common = with types; { + enable = mkBoolOpt false "Whether or not to enable common configuration."; + }; + + config = mkIf cfg.enable { + programs.fish = enabled; + + plusultra = { + nix = enabled; + + #cli-apps = { + # neovim = enabled; + #}; + + tools = { + git = enabled; + #flake = enabled; + }; + + system = { + fonts = enabled; + #input = enabled; + interface = enabled; + }; + + security = { + gpg = enabled; + }; + }; + }; +} diff --git a/modules/darwin/suites/development/default.nix b/modules/darwin/suites/development/default.nix new file mode 100644 index 0000000..17b8779 --- /dev/null +++ b/modules/darwin/suites/development/default.nix @@ -0,0 +1,35 @@ +{ options, config, lib, pkgs, ... }: + +with lib; +with lib.plusultra; +let + cfg = config.plusultra.suites.development; +in +{ + options.plusultra.suites.development = with types; { + enable = mkBoolOpt false + "Whether or not to enable common development configuration."; + }; + + config = mkIf cfg.enable { + plusultra = { + #apps = { + # vscode = enabled; + #}; + + tools = { + # at = enabled; + # direnv = enabled; + # go = enabled; + # http = enabled; + # k8s = enabled; + # node = enabled; + # titan = enabled; + # python = enabled; + # java = enabled; + }; + + # virtualisation = { podman = enabled; }; + }; + }; +} diff --git a/modules/darwin/system/fonts/default.nix b/modules/darwin/system/fonts/default.nix new file mode 100644 index 0000000..b1483e0 --- /dev/null +++ b/modules/darwin/system/fonts/default.nix @@ -0,0 +1,32 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +with lib.plusultra; +let cfg = config.plusultra.system.fonts; +in +{ + options.plusultra.system.fonts = with types; { + enable = mkBoolOpt false "Whether or not to manage fonts."; + fonts = mkOpt (listOf package) [ ] "Custom font packages to install."; + }; + + config = mkIf cfg.enable { + environment.variables = { + # Enable icons in tooling since we have nerdfonts. + LOG_ICONS = "true"; + }; + + fonts = { + fontDir = enabled; + + fonts = with pkgs; + [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + noto-fonts-emoji + (nerdfonts.override { fonts = [ "Hack" ]; }) + ] ++ cfg.fonts; + }; + }; +} diff --git a/modules/darwin/system/interface/default.nix b/modules/darwin/system/interface/default.nix new file mode 100644 index 0000000..4ecfdf5 --- /dev/null +++ b/modules/darwin/system/interface/default.nix @@ -0,0 +1,29 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +with lib.plusultra; +let cfg = config.plusultra.system.interface; +in +{ + options.plusultra.system.interface = with types; { + enable = mkEnableOption "macOS interface"; + }; + + config = mkIf cfg.enable { + system.defaults = { + dock.autohide = true; + + finder = { + AppleShowAllExtensions = true; + FXEnableExtensionChangeWarning = false; + }; + + NSGlobalDomain = { + _HIHideMenuBar = true; + AppleShowScrollBars = "Always"; + }; + }; + + plusultra.home.file.".hushlogin".text = ""; + }; +} diff --git a/modules/darwin/tools/flake/default.nix b/modules/darwin/tools/flake/default.nix new file mode 100644 index 0000000..9f50aee --- /dev/null +++ b/modules/darwin/tools/flake/default.nix @@ -0,0 +1,18 @@ +{ lib, config, pkgs, ... }: + +with lib; +with lib.plusultra; +let + cfg = config.plusultra.tools.flake; +in +{ + options.plusultra.tools.flake = { + enable = mkEnableOption "Flake"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + snowfallorg.flake + ]; + }; +} diff --git a/modules/darwin/tools/git/default.nix b/modules/darwin/tools/git/default.nix new file mode 100644 index 0000000..8a2d8f1 --- /dev/null +++ b/modules/darwin/tools/git/default.nix @@ -0,0 +1,62 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +with lib.plusultra; +let + cfg = config.plusultra.tools.git; + gpg = config.plusultra.security.gpg; + user = config.plusultra.user; +in +{ + options.plusultra.tools.git = with types; { + enable = mkEnableOption "Git"; + userName = mkOpt types.str user.fullName "The name to configure git with."; + userEmail = mkOpt types.str user.email "The email to configure git with."; + signingKey = + mkOpt types.str "7F3D64824AC0B6B8009E50504BC0896FB5693595" "The key ID to sign commits with."; + signByDefault = mkOpt types.bool false "Whether to sign commits by default."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ git ]; + plusultra.home.extraOptions = { + programs.git = { + enable = true; + inherit (cfg) userName userEmail; + lfs = enabled; + signing = { + key = cfg.signingKey; + signByDefault = mkIf gpg.enable true; + }; + + extraConfig = { + init = { defaultBranch = "main"; }; + pull = { rebase = true; }; + push = { autoSetupRemote = true; }; + core = { whitespace = "trailing-space,space-before-tab"; }; + safe = { + directory = "${config.users.users.${user.name}.home}/git"; + }; + "credential \"https://github.com\"" = { + helper = "!gh auth git-credential"; + }; + alias = { + co = "checkout"; + ci = "commit --signoff"; + }; + pull.ff = "only"; + core.pager = "${pkgs.delta}/bin/delta"; + delta = { + features = "decorations"; + syntax-theme = "Dracula"; + light = "false"; + navigate = "true"; + }; + interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only"; + merge.conflictStyle = "diff3"; + diff.colorMoved = "default"; + }; + }; + }; + }; +} diff --git a/modules/darwin/tools/java/default.nix b/modules/darwin/tools/java/default.nix new file mode 100644 index 0000000..aa51095 --- /dev/null +++ b/modules/darwin/tools/java/default.nix @@ -0,0 +1,17 @@ +{ options, config, lib, pkgs, ... }: + +with lib; +with lib.plusultra; +let cfg = config.plusultra.tools.java; +in +{ + options.plusultra.tools.java = with types; { + enable = mkBoolOpt false "Whether or not to enable Java."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + jdk + ]; + }; +} diff --git a/modules/darwin/tools/node/default.nix b/modules/darwin/tools/node/default.nix new file mode 100644 index 0000000..9a70afd --- /dev/null +++ b/modules/darwin/tools/node/default.nix @@ -0,0 +1,42 @@ +{ options +, config +, pkgs +, lib +, ... +}: +with lib; +with lib.plusultra; let + cfg = config.plusultra.tools.node; +in +{ + options.plusultra.tools.node = with types; { + enable = mkBoolOpt false "Whether or not to install and configure git"; + pkg = mkOpt package pkgs.nodejs "The NodeJS package to use"; + prettier = { + enable = mkBoolOpt true "Whether or not to install Prettier"; + pkg = + mkOpt package pkgs.nodePackages.prettier "The NodeJS package to use"; + }; + yarn = { + enable = mkBoolOpt true "Whether or not to install Yarn"; + pkg = mkOpt package pkgs.nodePackages.yarn "The NodeJS package to use"; + }; + pnpm = { + enable = mkBoolOpt true "Whether or not to install Pnpm"; + pkg = mkOpt package pkgs.nodePackages.pnpm "The NodeJS package to use"; + }; + flyctl = { + enable = mkBoolOpt true "Whether or not to install flyctl"; + pkg = mkOpt package pkgs.flyctl "The flyctl package to use"; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; + [ cfg.pkg ] + ++ (lib.optional cfg.prettier.enable cfg.prettier.pkg) + ++ (lib.optional cfg.yarn.enable cfg.yarn.pkg) + ++ (lib.optional cfg.pnpm.enable cfg.pnpm.pkg) + ++ (lib.optional cfg.flyctl.enable cfg.flyctl.pkg); + }; +} diff --git a/modules/darwin/tools/python/default.nix b/modules/darwin/tools/python/default.nix new file mode 100644 index 0000000..34de5a8 --- /dev/null +++ b/modules/darwin/tools/python/default.nix @@ -0,0 +1,22 @@ +{ options, config, lib, pkgs, ... }: + +with lib; +with lib.plusultra; +let cfg = config.plusultra.tools.python; +in +{ + options.plusultra.tools.python = with types; { + enable = mkBoolOpt false "Whether or not to enable Python."; + }; + + config = + mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + (python311.withPackages (ps: + with ps; [ + numpy + ]) + ) + ]; + }; +} diff --git a/modules/darwin/user/default.nix b/modules/darwin/user/default.nix new file mode 100644 index 0000000..1554974 --- /dev/null +++ b/modules/darwin/user/default.nix @@ -0,0 +1,45 @@ +{ lib +, config +, pkgs +, ... +}: +let + inherit (lib) types mkIf mkDefault; + inherit (lib.plusultra) mkOpt; + + cfg = config.plusultra.user; + + is-linux = pkgs.stdenv.isLinux; + is-darwin = pkgs.stdenv.isDarwin; +in +{ + options.plusultra.user = { + name = mkOpt types.str "harald" "The user account."; + + fullName = mkOpt types.str "Harald Hoyer" "The full name of the user."; + email = mkOpt types.str "harald@hoyer.xyz" "The email of the user."; + + uid = mkOpt (types.nullOr types.int) 501 "The uid for the user account."; + }; + + config = { + users.users.${cfg.name} = { + # NOTE: Setting the uid here is required for another + # module to evaluate successfully since it reads + # `users.users.${plusultra.user.name}.uid`. + uid = mkIf (cfg.uid != null) cfg.uid; + }; + + snowfallorg.users.${config.plusultra.user.name}.home.config = { + home = { + file = { + ".profile".text = '' + # The default file limit is far too low and throws an error when rebuilding the system. + # See the original with: ulimit -Sa + ulimit -n 4096 + ''; + }; + }; + }; + }; +} diff --git a/modules/home/cli-apps/home-manager/default.nix b/modules/home/cli-apps/home-manager/default.nix index ab7ae34..27783ce 100644 --- a/modules/home/cli-apps/home-manager/default.nix +++ b/modules/home/cli-apps/home-manager/default.nix @@ -18,12 +18,13 @@ in BATDIFF_USE_DELTA = "true"; }; +/* home.shellAliases = { cat = "${pkgs.bat}/bin/bat --decorations never"; less = ''${pkgs.bat}/bin/bat --decorations never --paging=always --pager "${pkgs.less}/bin/less -RF"''; man = "${pkgs.bat-extras.batman}/bin/batman"; }; - +*/ home.packages = with pkgs; [ vim ]; diff --git a/modules/nixos/tools/git/default.nix b/modules/nixos/tools/git/default.nix index d0ebf79..a963f0d 100644 --- a/modules/nixos/tools/git/default.nix +++ b/modules/nixos/tools/git/default.nix @@ -41,15 +41,14 @@ in }; alias = { co = "checkout"; - ci = "commit"; + ci = "commit --signoff"; }; pull.ff = "only"; core.pager = "${pkgs.delta}/bin/delta"; delta = { - features = "side-by-side line-numbers decorations"; - syntax-theme = "DarkNeon"; + features = "decorations"; + syntax-theme = "Dracula"; light = "false"; - line-numbers = "false"; navigate = "true"; }; interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only"; diff --git a/systems/x86_64-darwin/mpro/default.nix b/systems/x86_64-darwin/mpro/default.nix new file mode 100644 index 0000000..054a38e --- /dev/null +++ b/systems/x86_64-darwin/mpro/default.nix @@ -0,0 +1,17 @@ +{ lib, pkgs, ... }: + +with lib.plusultra; +{ + plusultra = { + suites = { + common = enabled; + development = enabled; + }; + }; + + environment.systemPath = [ + "/usr/local/Homebrew/bin" + ]; + + system.stateVersion = 4; +} diff --git a/systems/x86_64-linux/sgx/default.nix b/systems/x86_64-linux/sgx/default.nix index f53bc16..5eeeb5a 100644 --- a/systems/x86_64-linux/sgx/default.nix +++ b/systems/x86_64-linux/sgx/default.nix @@ -21,7 +21,7 @@ with lib.plusultra; virtualisation.docker.enable = true; virtualisation.podman.dockerCompat = false; - + system.autoUpgrade = { enable = true; operation = "boot";