refactor(nix): Preparing setup for other n*x systems
This commit is contained in:
parent
767ba9ef03
commit
6a5c04a1e4
6 changed files with 390 additions and 3 deletions
240
.config/nix/flake.lock
generated
240
.config/nix/flake.lock
generated
|
@ -1,5 +1,97 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"crane": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727974419,
|
||||||
|
"narHash": "sha256-WD0//20h+2/yPGkO88d2nYbb23WMWYvnRyDQ9Dx4UHg=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "37e4f9f0976cb9281cd3f0c70081e5e0ecaee93f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devshell": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"system-manager",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722113426,
|
||||||
|
"narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1726560853,
|
||||||
|
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"system-manager",
|
||||||
|
"pre-commit-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -41,6 +133,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-vm-test": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"system-manager",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727688604,
|
||||||
|
"narHash": "sha256-V418lqfB49qSD9X5deClNNTkVoB0WDVaaYHI+cLAIi8=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-vm-test",
|
||||||
|
"rev": "72f9228db6582a59976e70e61b8257185434a8cf",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-vm-test",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720599075,
|
"lastModified": 1720599075,
|
||||||
|
@ -57,11 +170,136 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720386169,
|
||||||
|
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre-commit-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"system-manager",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728092656,
|
||||||
|
"narHash": "sha256-eMeCTJZ5xBeQ0f9Os7K8DThNVSo9gy4umZLDfF5q6OM=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "1211305a5b237771e13fcca0c51e60ad47326a9a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nix-darwin": "nix-darwin",
|
"nix-darwin": "nix-darwin",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"system-manager": "system-manager"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"system-manager",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728268235,
|
||||||
|
"narHash": "sha256-lJMFnMO4maJuNO6PQ5fZesrTmglze3UFTTBuKGwR1Nw=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "25685cc2c7054efc31351c172ae77b21814f2d42",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"system-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"crane": "crane",
|
||||||
|
"devshell": "devshell",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nix-vm-test": "nix-vm-test",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"pre-commit-hooks": "pre-commit-hooks",
|
||||||
|
"rust-overlay": "rust-overlay",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728426075,
|
||||||
|
"narHash": "sha256-HslwC/c4ZDXw6jGUGFCvsjxdUxUHy/EWTFMgwmiEGCs=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "system-manager",
|
||||||
|
"rev": "8182f9e3374c98a4d7a1ea212ad06b0c453cc290",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "system-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"system-manager",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727984844,
|
||||||
|
"narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,17 +3,24 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";
|
||||||
|
|
||||||
nix-darwin = {
|
nix-darwin = {
|
||||||
url = "github:LnL7/nix-darwin";
|
url = "github:LnL7/nix-darwin";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/release-24.05";
|
url = "github:nix-community/home-manager/release-24.05";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
system-manager = {
|
||||||
|
url = "github:numtide/system-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager }:
|
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, system-manager }:
|
||||||
let
|
let
|
||||||
vars = {
|
vars = {
|
||||||
user = "ziro"; # TODO: Make it possible to setup multi-user
|
user = "ziro"; # TODO: Make it possible to setup multi-user
|
||||||
|
@ -22,10 +29,18 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
darwinConfigurations = (
|
darwinConfigurations = (
|
||||||
import ./darwin {
|
import ./systems/darwin {
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
inherit inputs nixpkgs nix-darwin home-manager vars;
|
inherit inputs nixpkgs nix-darwin home-manager vars;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# FIXME: Not yet functional
|
||||||
|
systemConfigs = (
|
||||||
|
import ./systems/nix {
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
inherit inputs nixpkgs system-manager home-manager vars;
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
88
.config/nix/systems/nix/configuration.nix
Normal file
88
.config/nix/systems/nix/configuration.nix
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
{ pkgs, config, vars, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# NOTE: List packages installed in system profile. To search by name, run:
|
||||||
|
# `nix-env -qaP | grep wget`
|
||||||
|
environment.systemPackages =
|
||||||
|
let
|
||||||
|
python = (pkgs.python312Full.withPackages (py: [
|
||||||
|
py.pip
|
||||||
|
py.tkinter
|
||||||
|
py.dnspython
|
||||||
|
]));
|
||||||
|
in
|
||||||
|
[
|
||||||
|
pkgs.zsh
|
||||||
|
pkgs.git
|
||||||
|
pkgs.vim
|
||||||
|
pkgs.neovim
|
||||||
|
pkgs.pass
|
||||||
|
pkgs.passExtensions.pass-otp
|
||||||
|
pkgs.gnupg
|
||||||
|
pkgs.htop-vim
|
||||||
|
python
|
||||||
|
(pkgs.inkscape.override { python3 = python; })
|
||||||
|
#(pkgs.poetry.override { python3 = python; })
|
||||||
|
pkgs.fastfetch
|
||||||
|
pkgs.eza
|
||||||
|
pkgs.lf
|
||||||
|
pkgs.wimlib
|
||||||
|
pkgs.google-cloud-sdk
|
||||||
|
pkgs.nmap
|
||||||
|
pkgs.cargo
|
||||||
|
pkgs.android-tools
|
||||||
|
pkgs.coreutils-full
|
||||||
|
pkgs.rclone
|
||||||
|
(pkgs.yt-dlp.override { withAlias = true; })
|
||||||
|
pkgs.zoxide
|
||||||
|
];
|
||||||
|
|
||||||
|
# Auto upgrade nix package and the daemon service.
|
||||||
|
services.nix-daemon.enable = true;
|
||||||
|
#nix.package = pkgs.nix;
|
||||||
|
|
||||||
|
# Necessary for using flakes on this system.
|
||||||
|
nix.settings.experimental-features = "nix-command flakes";
|
||||||
|
|
||||||
|
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||||
|
programs.zsh.enable = true; # default shell on catalina
|
||||||
|
#programs.fish.enable = true;
|
||||||
|
|
||||||
|
# Set Git commit hash for darwin-version.
|
||||||
|
system.configurationRevision = vars.rev or null;
|
||||||
|
|
||||||
|
# Used for backwards compatibility, please read the changelog before changing.
|
||||||
|
# $ darwin-rebuild changelog
|
||||||
|
system = {
|
||||||
|
stateVersion = 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
# users.users.ziro = {
|
||||||
|
# name = vars.user;
|
||||||
|
# home = "/Users/${vars.user}";
|
||||||
|
# };
|
||||||
|
# home-manager.users.ziro = {
|
||||||
|
# home.stateVersion = "22.05";
|
||||||
|
|
||||||
|
# programs = {
|
||||||
|
# browserpass = {
|
||||||
|
# enable = true;
|
||||||
|
# browsers = [ "brave" "chrome" ]; # Arc and Chrome share the same `Application Support` dir, not sure why tbh.
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
# # Swap CapsLock with Esc for better vi-mode experience.
|
||||||
|
# launchd.agents.CapsEscSwap = {
|
||||||
|
# enable = true;
|
||||||
|
# config = {
|
||||||
|
# ProgramArguments = [
|
||||||
|
# "/usr/bin/hidutil"
|
||||||
|
# "property"
|
||||||
|
# "--set"
|
||||||
|
# "{\"UserKeyMapping\":[{\"HIDKeyboardModifierMappingSrc\":0x700000039,\"HIDKeyboardModifierMappingDst\":0x700000029},{\"HIDKeyboardModifierMappingSrc\":0x700000029,\"HIDKeyboardModifierMappingDst\":0x700000039}]}"
|
||||||
|
# ];
|
||||||
|
# RunAtLoad = true;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
}
|
46
.config/nix/systems/nix/default.nix
Normal file
46
.config/nix/systems/nix/default.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{ inputs, nixpkgs, system-manager, home-manager, vars, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
disablePyChecks = pkg: pkg.overridePythonAttrs (old: {
|
||||||
|
doCheck = false;
|
||||||
|
doInstallCheck = false;
|
||||||
|
dontCheck = true;
|
||||||
|
});
|
||||||
|
systemConfig = system: {
|
||||||
|
system = system;
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [(final: prev: {
|
||||||
|
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [(pyfinal: pyprev: {
|
||||||
|
dnspython = (disablePyChecks pyprev.dnspython).overridePythonAttrs (old: {
|
||||||
|
disabledTests = [
|
||||||
|
# This test is unreliable when my internet is throttled by Indonesian ISP, timeout everywhere... lovely...
|
||||||
|
"test_resolver"
|
||||||
|
] ++ old.disabledTests;
|
||||||
|
});
|
||||||
|
pillow = disablePyChecks pyprev.pillow;
|
||||||
|
cherrypy = disablePyChecks pyprev.cherrypy;
|
||||||
|
})];
|
||||||
|
})];
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"potato" =
|
||||||
|
let
|
||||||
|
inherit (systemConfig "x86_64-linux") system pkgs;
|
||||||
|
in
|
||||||
|
system-manager.lib.makeSystemConfig {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = { inherit inputs pkgs home-manager vars; };
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
# home-manager.darwinModules.home-manager
|
||||||
|
# {
|
||||||
|
# home-manager.useGlobalPkgs = true;
|
||||||
|
# home-manager.useUserPackages = true;
|
||||||
|
# }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue