diff --git a/flake.lock b/flake.lock index 4b984ab..eacea29 100644 --- a/flake.lock +++ b/flake.lock @@ -36,10 +36,27 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1755704039, + "narHash": "sha256-gKlP0LbyJ3qX0KObfIWcp5nbuHSb5EHwIvU6UcNBg2A=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9cb344e96d5b6918e94e1bca2d9f3ea1e9615545", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" } } }, diff --git a/flake.nix b/flake.nix index 3189135..8c05b3a 100644 --- a/flake.nix +++ b/flake.nix @@ -16,30 +16,34 @@ inputs.nixpkgs.follows = "nixpkgs"; }; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.05"; }; - outputs = { - self, - home-manager, - nixpkgs, - ... - } @ inputs: let - inherit (self) outputs; - in { - overlays = import ./overlays {inherit inputs outputs;}; + outputs = + { + self, + home-manager, + nixpkgs, + ... + }@inputs: + let + inherit (self) outputs; + in + { + overlays = import ./overlays { inherit inputs outputs; }; - homeConfigurations = { - "m3tam3re@m3-daedalus" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages."x86_64-linux"; - extraSpecialArgs = { - inherit inputs outputs; - systemConfig = {}; + homeConfigurations = { + "m3tam3re@m3-daedalus" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."aarch64-linux"; + extraSpecialArgs = { + inherit inputs outputs; + systemConfig = { }; + }; + modules = [ + ./users/m3tam3re + ./users/m3tam3re/profiles/server.nix + ]; }; - modules = [ - ./users/m3tam3re - ./users/m3tam3re/profiles/server.nix - ]; }; }; - }; } diff --git a/modules/base.nix b/modules/base.nix index f3166d0..d00b9af 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -1,10 +1,13 @@ { lib, + outputs, pkgs, ... -}: { +}: +{ nixpkgs = { overlays = [ + outputs.overlays.stable-packages ]; config = { allowUnfree = true; @@ -15,7 +18,10 @@ nix = { package = lib.mkDefault pkgs.nix; settings = { - experimental-features = ["nix-command" "flakes"]; + experimental-features = [ + "nix-command" + "flakes" + ]; warn-dirty = false; }; }; diff --git a/modules/coding/default.nix b/modules/coding/default.nix new file mode 100644 index 0000000..606aa1b --- /dev/null +++ b/modules/coding/default.nix @@ -0,0 +1,93 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +let + goCfg = config.features.coding.go; + nixCfg = config.features.coding.nix; + pythonCfg = config.features.coding.python; +in +{ + options.features.coding = { + go = { + enable = mkEnableOption "enable Go development environment"; + packageSet = mkOption { + type = types.str; + default = "default"; + description = "Which nixpkgs variant to use for Golang"; + }; + additionalPackages = mkOption { + type = types.listOf types.str; + example = [ + delve + go-outline + ]; + }; + + }; + python = { + enable = mkEnableOption "enable Python development environment"; + additionalPackages = mkOption { + type = types.listOf types.str; + example = [ + "requests" + "pandas" + ]; + }; + }; + nix = { + enable = mkEnableOption "enable Nix development environment"; + }; + }; + + config = + let + selectPkgs = packageSet: if packageSet == "default" then pkgs else pkgs.${packageSet}; + in + mkMerge [ + (mkIf goCfg.enable ( + let + goPkgs = selectPkgs goCfg.packageSet; + in + { + home.packages = + with goPkgs; + [ + go + gopls + ] + ++ (map (name: goPkgs.${name}) goCfg.additionalPackages); + } + )) + (mkIf pythonCfg.enable { + home.packages = with pkgs; [ + (python3.withPackages ( + ps: + with ps; + [ + uv + pip + pipx + virtualenv + ] + ++ (map (name: ps.${name}) pythonCfg.additionalPackages) + )) + pyrefly + black + ]; + }) + (mkIf nixCfg.enable { + home.packages = with pkgs; [ + alejandra + nil + nixd + statix + deadnix + nix-tree + ]; + }) + ]; +} diff --git a/modules/default.nix b/modules/default.nix index 44c00c7..3a6d81a 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,6 +1,7 @@ {...}: { imports = [ ./cli + ./coding ./base.nix ]; } diff --git a/overlays/default.nix b/overlays/default.nix index 91dd98d..4c963a7 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,6 +1,7 @@ -{inputs, ...}: { +{ inputs, ... }: +{ # This one brings our custom packages from the 'pkgs' directory - additions = final: prev: (import ../pkgs {pkgs = final;}); + additions = final: prev: (import ../pkgs { pkgs = final; }); # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. # https://nixos.wiki/wiki/Overlays @@ -25,10 +26,10 @@ # }); }; - # stable-packages = final: _prev: { - # stable = import inputs.nixpkgs-stable { - # system = final.system; - # config.allowUnfree = true; - # }; - # }; + stable-packages = final: _prev: { + stable = import inputs.nixpkgs-stable { + system = final.system; + config.allowUnfree = true; + }; + }; } diff --git a/users/m3tam3re/profiles/server.nix b/users/m3tam3re/profiles/server.nix index 334e93e..c881dbb 100644 --- a/users/m3tam3re/profiles/server.nix +++ b/users/m3tam3re/profiles/server.nix @@ -1,9 +1,31 @@ -{...}: { +{ pkgs, ... }: +{ features = { cli = { shell.nushell.enable = true; shell.nitch.enable = true; tools.fzf.enable = true; }; + coding = { + nix = { + enable = true; + }; + go = { + enable = true; + packageSet = "stable"; + additionalPackages = [ + "gotools" + "gotests" + "go-outline" + ]; + }; + python = { + enable = true; + additionalPackages = [ + "requests" + "pandas" + ]; + }; + }; }; }