nixos/flake.nix

140 lines
4.0 KiB
Nix
Raw Normal View History

2021-07-13 09:53:22 +01:00
{
inputs = {
2024-11-18 19:58:44 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
nixos-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-master.url = "github:NixOS/nixpkgs/master";
2024-04-24 16:05:05 +01:00
local-unstable.url = "path:///home/giulio/dev/nixpkgs";
teslamate-flake.url = "github:teslamate-org/teslamate/v1.32.0";
agenix-flake.url = "github:ryantm/agenix";
2021-07-13 09:53:22 +01:00
home-manager = {
2024-11-18 19:58:44 +00:00
url = "github:nix-community/home-manager/release-24.11";
2021-07-13 09:53:22 +01:00
inputs.nixpkgs.follows = "nixpkgs";
2021-11-25 11:42:32 +00:00
};
nvidia-patch = {
url = "github:icewind1991/nvidia-patch-nixos";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-07-13 09:53:22 +01:00
};
2021-10-13 13:29:07 +01:00
outputs =
{ self
, nixpkgs
, nixos-unstable
, nixos-master
, local-unstable
, home-manager
, teslamate-flake
, nvidia-patch
, agenix-flake
}:
2021-11-25 11:42:32 +00:00
let
sysLinuxX64 = "x86_64-linux";
sysDarwin = "aarch64-darwin";
sysLinuxAarch = "aarch64-linux";
2021-10-13 13:29:07 +01:00
wrapPkgsSystem = { system, cudaSupport ? false }:
let
config = {
inherit cudaSupport;
allowUnfree = true;
};
extOverlays = [
(nvidia-patch.overlays.default)
];
importNixpkgs = { flake }:
import flake {
inherit system config;
overlays = extOverlays;
};
unstablePkgs = importNixpkgs { flake = nixos-unstable; };
masterPkgs = importNixpkgs { flake = nixos-master; };
localPkgs = importNixpkgs { flake = local-unstable; };
teslamatePkgs = importNixpkgs { flake = teslamate-flake; };
agenixPkgs = importNixpkgs { flake = agenix-flake; };
additionalOverlays = [
(final: prev: { inherit unstablePkgs; })
2024-02-21 11:43:26 +00:00
(final: prev: { inherit localPkgs; })
(final: prev: { inherit teslamatePkgs; })
(final: prev: { inherit agenixPkgs; })
(final: prev: { inherit masterPkgs; })
];
in
import nixpkgs {
inherit system config;
overlays = additionalOverlays ++ extOverlays;
2022-10-13 18:05:31 +01:00
};
2021-10-13 13:29:07 +01:00
wrapUtils = { pkgs }:
let
inherit (pkgs.lib) makeScope;
inherit (pkgs) newScope;
in
makeScope newScope (self: rec {
inherit nixpkgs home-manager nixos-unstable;
inherit (self.callPackage ./lib/utils.nix { }) mkSysRole mkHomeRole;
inherit (user) mkUser;
user = self.callPackage ./lib/user.nix { };
host = self.callPackage ./lib/host.nix { };
});
2023-02-11 01:32:17 +00:00
2024-03-13 18:38:32 +00:00
pkgsLinuxX64Cuda = wrapPkgsSystem { system = sysLinuxX64; };
utilsLinuxX64Cuda = wrapUtils { pkgs = pkgsLinuxX64Cuda; };
pkgsLinuxAarch = wrapPkgsSystem { system = sysLinuxAarch; };
utilsLinuxAarch = wrapUtils { pkgs = pkgsLinuxAarch; };
2023-02-06 22:33:36 +00:00
pkgsDarwin = wrapPkgsSystem { system = sysDarwin; };
utilsDarwin = wrapUtils { pkgs = pkgsDarwin; };
2022-11-22 12:05:53 +00:00
in
{
2021-11-25 11:42:32 +00:00
nixosConfigurations = {
architect = utilsLinuxX64Cuda.host.mkHost {
2021-11-25 11:42:32 +00:00
name = "architect";
2021-11-25 11:47:13 +00:00
users = [{
user = "giulio";
roles = [ ];
}];
imports = [
teslamate-flake.nixosModules.default
agenix-flake.nixosModules.default
];
2021-11-25 11:42:32 +00:00
};
};
2023-02-17 17:04:32 +00:00
2023-02-06 22:30:35 +00:00
homeConfigurations = {
giulioMac = utilsDarwin.user.mkHMUser {
name = "giulio";
roles = [ "ssh" ];
};
2023-02-06 22:33:36 +00:00
giulioAarch = utilsLinuxAarch.user.mkHMUser {
name = "giulio";
roles = [ "ssh" ];
};
giulioX64 = utilsLinuxX64Cuda.user.mkHMUser {
name = "giulio";
2023-03-03 18:03:26 +00:00
roles = [ "ssh" "go" ];
};
giulioX64NoSSH = utilsLinuxX64Cuda.user.mkHMUser {
2023-03-03 18:04:12 +00:00
name = "giulio";
roles = [ "go" ];
};
2022-10-14 13:17:50 +01:00
};
2023-02-17 17:04:32 +00:00
defaultTemplate = self.templates.basicShell;
templates = {
basicShell = {
path = ./templates/basicShell;
description = "A barebone shell with custom defined packages";
};
2023-02-17 17:04:32 +00:00
};
2021-08-23 12:25:36 +01:00
};
2021-07-13 09:53:22 +01:00
}