From c0384c43821474d28af1d9696ceb473a0d769292 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 31 Oct 2024 16:49:01 +0100 Subject: Switch back to flakes This reverts commits: - 66e56cb0e1c95202133733c0812b794171dc73c5. - 3fae7d35d9b32ab3c4f7293c418167a52aff8717. - 417a1ce6481adfc713d8d0d6ad03e211a3d0eb22. - 6b4469a98d7b2d88a3442b1051174000538199f0. --- .envrc | 8 - REUSE.toml | 5 - bin/darwin-rebuild | 1 - bin/home-manager | 152 ---------- bin/nixos-rebuild | 1 - flake.lock | 519 ++++++++++++++++++++++++++++++++++ flake.nix | 156 ++++++++++ lib/default.nix | 25 -- npins/default.nix | 80 ------ npins/sources.json | 95 ------- overlays/emacs.nix | 1 - overlays/nur.nix | 3 - overlays/personal.nix | 13 - shell.nix | 20 -- sources.nix | 15 - system/linde.nix | 10 - system/mba.nix | 1 - system/prefect.nix | 5 - system/settings/configuration/nix.nix | 1 - system/settings/pin.nix | 12 - user/mba.nix | 2 - user/prefect.nix | 2 - user/server.nix | 1 - user/settings/base.nix | 5 +- user/settings/nix.nix | 3 +- user/settings/shell.nix | 2 +- 26 files changed, 678 insertions(+), 460 deletions(-) delete mode 100644 .envrc delete mode 120000 bin/darwin-rebuild delete mode 100755 bin/home-manager delete mode 120000 bin/nixos-rebuild create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 lib/default.nix delete mode 100644 npins/default.nix delete mode 100644 npins/sources.json delete mode 100644 overlays/emacs.nix delete mode 100644 overlays/nur.nix delete mode 100644 overlays/personal.nix delete mode 100644 shell.nix delete mode 100644 sources.nix delete mode 100644 system/settings/pin.nix diff --git a/.envrc b/.envrc deleted file mode 100644 index e7aaa238..00000000 --- a/.envrc +++ /dev/null @@ -1,8 +0,0 @@ -if type -P lorri &>/dev/null; then - eval "$(lorri direnv)" -else - echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]' - use nix -fi -PATH_add bin -FLAKE=$PWD diff --git a/REUSE.toml b/REUSE.toml index a044e623..90f300c0 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -9,11 +9,6 @@ path = "**/*" SPDX-FileCopyrightText = "2024 Alan Pearce " SPDX-License-Identifier = "MIT" -[[annotations]] -path = ["npins/*"] -SPDX-FileCopyrightText = "NONE" -SPDX-License-Identifier = "CC0-1.0" - [[annotations]] path = "**/*.el" SPDX-FileCopyrightText = "2024 Alan Pearce " diff --git a/bin/darwin-rebuild b/bin/darwin-rebuild deleted file mode 120000 index 2eaccdef..00000000 --- a/bin/darwin-rebuild +++ /dev/null @@ -1 +0,0 @@ -home-manager \ No newline at end of file diff --git a/bin/home-manager b/bin/home-manager deleted file mode 100755 index cf434738..00000000 --- a/bin/home-manager +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env fish - -if not set --query HOME - echo "error: no HOME" - exit 1 -end - -set --query XDG_STATE_HOME || set --function XDG_STATE_HOME $HOME/.local/state -set --function nix_state_home $XDG_STATE_HOME/nix -set --function channel_root $nix_state_home/channels -set --function user_nixpkgs $HOME/.config/nixpkgs -set --function nixfiles (path resolve (status dirname)/..) - -if set --query XDG_CONFIG_HOME - set --function hm_config_dir $XDG_CONFIG_HOME/home-manager -else - set --function hm_config_dir $HOME/.config/home-manager -end - -for i in 1 - if test ! -d $user_nixpkgs - if test ! -e $user_nixpkgs && test -L $user_nixpkgs - echo "~/.config/nixpkgs is a broken symlink, deleting it" - rm $channel_root - end - echo "user nixpkgs folder $user_nixpkgs does not exist, creating it" - mkdir -p $user_nixpkgs - end - if test -L $hm_config_dir -a (path resolve $hm_config_dir) = (path resolve (status basename)) - if test y = (read --nchars=1 --prompt-str="$hm_config_dir already exists as a symlink to the current directory. Remove it [yN]? ") - unlink $hm_config_dir - end - end - if test ! -d $hm_config_dir - echo "user home-manager configuration folder $hm_config_dir does not exist, creating it" - mkdir -p $hm_config_dir - end - if test ! -e $channel_root - if test -L $channel_root - # broken symlink - rm $channel_root - end - echo "channel root $channel_root does not exist, creating it" - mkdir -p $channel_root - else - if test ! -d $channel_root - echo "error: $channel_root is not a directory" - else if test -L $channel_root - echo "error: $channel_root is a symlink, please remove it" - else if path is --invert --perm write $channel_root - echo "error: $channel_root is not writable; might be a symlink" - else if path is --invert --type link $channel_root/* - for p in (path filter --invert --type link $channel_root/*) - # might be a broken symlink - if test -L $p -a ! -e $p - rm $p - else - echo "error: channel $p is not a broken symlink, don't know what to do with it" - end - end - # check again and fail if there are still unknown files - if path is --invert --type link $channel_root/* - echo "error: non-link(s) in $channel_root" - path filter --invert --type link $channel_root/* - else - continue - end - else - continue # with script - end - exit 1 - end -end - -set --function current_script_name (status basename) -switch $current_script_name - case darwin-rebuild - set --local darwin_config_source $nixfiles/system/$hostname.nix - set --local darwin_config_target $user_nixpkgs/darwin-configuration.nix - if test ! -e $darwin_config_target - ln -s $darwin_config_source $darwin_config_target - end - set --append argv -I darwin-config=$darwin_config_source - case nixos-rebuild - set --local nixos_config_source $nixfiles/system/$hostname.nix - set --local nixos_config_target $user_nixpkgs/configuration.nix - if test ! -e $nixos_config_target - ln -s $nixos_config_source $nixos_config_target - end - if ! fish_is_root_user - set --append argv --use-remote-sudo - end - set --append argv -I nixos-config=$nixos_config_source - case home-manager - set --local hm_config_source $nixfiles/user/$hostname.nix - set --local hm_config_target $hm_config_dir/home.nix - if test ! -e $hm_config_target - ln -s $hm_config_source $hm_config_target - end - set --export HOME_MANAGER_CONFIG $hm_config_source -end - -set --function old_channels (path basename $channel_root/*) - -function update_link --argument-names new_src target - set --function current_src (path resolve $target) - if test -e $current_src - if test $current_src = $new_src - # no need to re-link it - return - else - unlink $target - end - end - ln -s $new_src $target -end - -for np in $NIX_PATH - if string match --quiet --entire "=" $np - echo $np | read --function --delimiter "=" channel new_src_rel - set --local new_src (path resolve $new_src_rel) - - if test $channel = darwin-config - continue - end - if set --local i (contains --index $channel $old_channels) - set --erase old_channels[$i] - end - - update_link $new_src $channel_root/$channel - end -end - -for old in $channel_root/$old_channels - rm $old -end - -if set --function i (contains --index (status dirname) $PATH) && test -n $i - set --erase PATH[$i] -end - -set --function cmd $current_script_name $argv - -if contains -- -n $argv - set --prepend cmd echo -end - -if set --query IN_NIX_SHELL - eval $cmd -else - nix-shell --run "$cmd" -end diff --git a/bin/nixos-rebuild b/bin/nixos-rebuild deleted file mode 120000 index 2eaccdef..00000000 --- a/bin/nixos-rebuild +++ /dev/null @@ -1 +0,0 @@ -home-manager \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..c63285a3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,519 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1723293904, + "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", + "owner": "ryantm", + "repo": "agenix", + "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "darwin_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730448474, + "narHash": "sha256-qE/cYKBhzxHMtKtLK3hlSR3uzO1pWPGLrBuQK7r0CHc=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "683d0c4cd1102dcccfa3f835565378c7f3cbe05e", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "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_2" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "searchix", + "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" + } + }, + "golink": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs-small" + ] + }, + "locked": { + "lastModified": 1729038018, + "narHash": "sha256-UMAQj/qfMp/8V7foUQ+vZl4NxrGHF7ihv7QXwbAPbkg=", + "owner": "tailscale", + "repo": "golink", + "rev": "701eb193420b16655a6060802faa5caf494ecc5f", + "type": "github" + }, + "original": { + "owner": "tailscale", + "repo": "golink", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": [ + "searchix", + "flake-utils" + ], + "nixpkgs": [ + "searchix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717050755, + "narHash": "sha256-C9IEHABulv2zEDFA+Bf0E1nmfN4y6MIUe5eM2RCrDC0=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "31b6d2e40b36456e792cd6cf50d5a8ddd2fa59a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730490306, + "narHash": "sha256-AvCVDswOUM9D368HxYD25RsSKp+5o0L0/JHADjLoD38=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1743615b61c7285976f85b303a36cdf88a556503", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729999765, + "narHash": "sha256-LYsavZXitFjjyETZoij8usXjTa7fa9AIF3Sk3MJSX+Y=", + "owner": "Mic92", + "repo": "nix-index-database", + "rev": "0e3a8778c2ee218eff8de6aacf3d2fa6c33b2d4f", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "nix-index-database", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1730537918, + "narHash": "sha256-GJB1/aaTnAtt9sso/EQ77TAGJ/rt6uvlP0RqZFnWue8=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "f6e0cd5c47d150c4718199084e5764f968f1b560", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1730200266, + "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-small": { + "locked": { + "lastModified": 1730449684, + "narHash": "sha256-Hlv3rTPxnO+DpKRXw9yjzERLdk05h7+fEbZxWM2taCw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ab464abbeb3a2833288c6e907488c49c2e599f88", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1710765496, + "narHash": "sha256-p7ryWEeQfMwTB6E0wIUd5V2cFTgq+DRRBz2hYGnJZyA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e367f7a1fb93137af22a3908f00b9a35e2d286a7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "personal": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730551010, + "narHash": "sha256-tVth43FHdqAXLps9hTKdQZAwMAeTwzqdezAefgr4PkM=", + "ref": "refs/heads/main", + "rev": "160bc961edad2ad0f75f8866f2588d6f5d72c639", + "revCount": 32, + "type": "git", + "url": "https://git.alanpearce.eu/nix-packages" + }, + "original": { + "type": "git", + "url": "https://git.alanpearce.eu/nix-packages" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1718819804, + "narHash": "sha256-kq0ujzXsaB+/GekCh293ftS98laLywuiS9m2s4xXtDQ=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "ed4ce202164abe17209a57f9d0ef4abf49e17b4b", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "darwin": "darwin_2", + "golink": "golink", + "home-manager": "home-manager_2", + "nix-index-database": "nix-index-database", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs", + "nixpkgs-small": "nixpkgs-small", + "personal": "personal", + "searchix": "searchix", + "secrets": "secrets", + "utils": "utils" + } + }, + "searchix": { + "inputs": { + "flake-utils": "flake-utils_2", + "gomod2nix": "gomod2nix", + "nixpkgs": [ + "nixpkgs-small" + ], + "pre-commit-hooks": "pre-commit-hooks", + "simple-css": "simple-css" + }, + "locked": { + "lastModified": 1723907745, + "narHash": "sha256-/El+sBJMczxtXdsFfQuk56RlxcKrKmbLrwx7AreYyao=", + "ref": "refs/heads/main", + "rev": "bb8e236fd5b4dbc083c1cbd18a18c380b9fc8d3b", + "revCount": 278, + "type": "git", + "url": "https://git.alanpearce.eu/searchix" + }, + "original": { + "type": "git", + "url": "https://git.alanpearce.eu/searchix" + } + }, + "secrets": { + "flake": false, + "locked": { + "lastModified": 1724763034, + "narHash": "sha256-IX3FlHvdrN1jghNQpFHEhZ7fPX9Bs3YiBp1r/f5lnYo=", + "ref": "refs/heads/main", + "rev": "2affab49f584a89d02432ff4705fdec6b8d0cdbf", + "revCount": 69, + "type": "git", + "url": "file:///home/alan/projects/alanpearce.eu/nixfiles/private" + }, + "original": { + "id": "secrets", + "type": "indirect" + } + }, + "simple-css": { + "flake": false, + "locked": { + "narHash": "sha256-aZTz1/XT7LZX9VfOclIumJzlUDLOlQLaZ89v6Ys26VU=", + "type": "file", + "url": "https://raw.githubusercontent.com/kevquirk/simple.css/v2.3.1/simple.css" + }, + "original": { + "type": "file", + "url": "https://raw.githubusercontent.com/kevquirk/simple.css/v2.3.1/simple.css" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..564b5006 --- /dev/null +++ b/flake.nix @@ -0,0 +1,156 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs-small.url = "github:NixOS/nixpkgs/nixos-unstable-small"; + nixos-hardware.url = "github:NixOS/nixos-hardware"; + nix-index-database.url = "github:Mic92/nix-index-database"; + nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; + darwin.url = "github:lnl7/nix-darwin/master"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + secrets = { + flake = false; + }; + utils.url = "github:numtide/flake-utils"; + agenix.url = "github:ryantm/agenix"; + agenix.inputs.nixpkgs.follows = "nixpkgs"; + personal = { + url = "git+https://git.alanpearce.eu/nix-packages"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + searchix = { + url = "git+https://git.alanpearce.eu/searchix"; + inputs.nixpkgs.follows = "nixpkgs-small"; + }; + golink = { + url = "github:tailscale/golink"; + inputs.nixpkgs.follows = "nixpkgs-small"; + }; + }; + + outputs = + inputs@ + { self + , utils + , nixpkgs + , nixpkgs-small + , nixos-hardware + , home-manager + , darwin + , nix-index-database + , secrets + , agenix + , personal + , searchix + , golink + , ... + }: + let + readOverlays = path: + let content = builtins.readDir path; in + map (n: import (path + ("/" + n))) + (builtins.filter + (n: + (builtins.match ".*\\.nix" n != null && + # ignore Emacs lock files (.#foo.nix) + builtins.match "\\.#.*" n == null) || + builtins.pathExists (path + ("/" + n + "/default.nix"))) + (builtins.attrNames content)); + + mkHomeConfiguration = { modules, system }: home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + inherit system; + overlays = readOverlays (toString ./overlays) ++ [ + (self: super: { + personal = personal.packages.${system}; + enchant = super.enchant.override { + withHspell = false; + withAspell = false; + }; + }) + ]; + }; + + inherit modules; + extraSpecialArgs = { + inherit inputs system; + }; + }; + in + { + nixosConfigurations.prefect = nixpkgs.lib.nixosSystem { + system = utils.lib.system.x86_64-linux; + specialArgs = { inherit inputs; }; + modules = [ + ./system/prefect.nix + ] ++ (with nixos-hardware.nixosModules; [ + common-cpu-amd + common-cpu-amd-pstate + common-pc-ssd + common-pc + common-gpu-nvidia-nonprime + ]); + }; + nixosConfigurations.nanopi = nixpkgs-small.lib.nixosSystem { + system = utils.lib.system.aarch64-linux; + specialArgs = { inherit inputs; }; + modules = [ + agenix.nixosModules.default + ./system/nanopi.nix + ]; + }; + nixosConfigurations.linde = nixpkgs-small.lib.nixosSystem { + system = utils.lib.system.aarch64-linux; + specialArgs = { inherit inputs; }; + modules = [ + agenix.nixosModules.default + searchix.nixosModules.web + golink.nixosModules.default + ./system/linde.nix + ]; + }; + darwinConfigurations.mba = darwin.lib.darwinSystem { + system = utils.lib.system.aarch64-darwin; + specialArgs = { inherit inputs; }; + modules = [ + ./system/mba.nix + personal.darwinModules.caddy + ]; + }; + homeConfigurations."alan@mba" = mkHomeConfiguration { + system = utils.lib.system.aarch64-darwin; + modules = [ + ./user/mba.nix + nix-index-database.hmModules.nix-index + (secrets + "/default.nix") + (secrets + "/ssh.nix") + ]; + }; + homeConfigurations."alan@prefect" = mkHomeConfiguration { + system = utils.lib.system.x86_64-linux; + modules = [ + ./user/prefect.nix + nix-index-database.hmModules.nix-index + (secrets + "/default.nix") + (secrets + "/ssh.nix") + ]; + }; + homeConfigurations."alan@nanopi" = mkHomeConfiguration { + system = utils.lib.system.aarch64-linux; + modules = [ + ./user/nanopi.nix + nix-index-database.hmModules.nix-index + (secrets + "/default.nix") + ]; + }; + homeConfigurations."alan@linde" = mkHomeConfiguration { + system = utils.lib.system.aarch64-linux; + modules = [ + ./user/server.nix + nix-index-database.hmModules.nix-index + (secrets + "/default.nix") + ]; + }; + }; +} diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index 2cbaf55c..00000000 --- a/lib/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ pkgs }: -with builtins; -let - inherit (pkgs) lib; -in -rec { - importPathStore = p: "${append ../. "/${p}"}"; - - mkPathable = s: toString ( - if lib.path.subpath.isValid s - then (lib.path.append ../. s) - else s - ); - - kvPath = k: v: "${k}=${v}"; - - fromSources = sources: - lib.attrsets.mapAttrs - (k: v: v.outPath) - sources; - - mkNixPath = sources: lib.attrsets.mapAttrsToList - (k: v: kvPath k (mkPathable v)) - sources; -} diff --git a/npins/default.nix b/npins/default.nix deleted file mode 100644 index 5e7d086e..00000000 --- a/npins/default.nix +++ /dev/null @@ -1,80 +0,0 @@ -# Generated by npins. Do not modify; will be overwritten regularly -let - data = builtins.fromJSON (builtins.readFile ./sources.json); - version = data.version; - - mkSource = - spec: - assert spec ? type; - let - path = - if spec.type == "Git" then - mkGitSource spec - else if spec.type == "GitRelease" then - mkGitSource spec - else if spec.type == "PyPi" then - mkPyPiSource spec - else if spec.type == "Channel" then - mkChannelSource spec - else - builtins.throw "Unknown source type ${spec.type}"; - in - spec // { outPath = path; }; - - mkGitSource = - { - repository, - revision, - url ? null, - hash, - branch ? null, - ... - }: - assert repository ? type; - # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository - # In the latter case, there we will always be an url to the tarball - if url != null then - (builtins.fetchTarball { - inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes - }) - else - assert repository.type == "Git"; - let - urlToName = - url: rev: - let - matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url; - - short = builtins.substring 0 7 rev; - - appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; - in - "${if matched == null then "source" else builtins.head matched}${appendShort}"; - name = urlToName repository.url revision; - in - builtins.fetchGit { - url = repository.url; - rev = revision; - inherit name; - # hash = hash; - }; - - mkPyPiSource = - { url, hash, ... }: - builtins.fetchurl { - inherit url; - sha256 = hash; - }; - - mkChannelSource = - { url, hash, ... }: - builtins.fetchTarball { - inherit url; - sha256 = hash; - }; -in -if version == 3 then - builtins.mapAttrs (_: mkSource) data.pins -else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json deleted file mode 100644 index cbd6da9c..00000000 --- a/npins/sources.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "pins": { - "agenix": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "ryantm", - "repo": "agenix" - }, - "branch": "main", - "revision": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", - "url": "https://github.com/ryantm/agenix/archive/f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41.tar.gz", - "hash": "1x8nd8hvsq6mvzig122vprwigsr3z2skanig65haqswn7z7amsvg" - }, - "darwin": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "lnl7", - "repo": "nix-darwin" - }, - "branch": "master", - "revision": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e", - "url": "https://github.com/lnl7/nix-darwin/archive/ac5694a0b855a981e81b4d9f14052e3ff46ca39e.tar.gz", - "hash": "0nxfc3nlvag3q33bhr9wyd6vjkzy9s2krw11ly4a1wss2gsh5zyf" - }, - "emacs-overlay": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "nix-community", - "repo": "emacs-overlay" - }, - "branch": "master", - "revision": "3052bb01d404ee9bd03b040c9ae898febca05b81", - "url": "https://github.com/nix-community/emacs-overlay/archive/3052bb01d404ee9bd03b040c9ae898febca05b81.tar.gz", - "hash": "1h5cr9rcm7asm961s5czbbna4b18zlx9kiyd6p8v82xrz7ln3s7i" - }, - "home-manager": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "nix-community", - "repo": "home-manager" - }, - "branch": "master", - "revision": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", - "url": "https://github.com/nix-community/home-manager/archive/c2cd2a52e02f1dfa1c88f95abeb89298d46023be.tar.gz", - "hash": "1wq1cn8r4igs5bb3fgcn8ima65rk427kkxkl25a0n6adabg35nah" - }, - "nix-index-database": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "Mic92", - "repo": "nix-index-database" - }, - "branch": "main", - "revision": "afc8f5a6a2c00a89a6d6bdcaf4157797960f10f7", - "url": "https://github.com/Mic92/nix-index-database/archive/afc8f5a6a2c00a89a6d6bdcaf4157797960f10f7.tar.gz", - "hash": "0kh8nyxp44wv5i37jwylf6vvjcwnr6zfqavxajb3zglhkrdfija6" - }, - "nixos-hardware": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "NixOS", - "repo": "nixos-hardware" - }, - "branch": "master", - "revision": "9fc19be21f0807d6be092d70bf0b1de0c00ac895", - "url": "https://github.com/NixOS/nixos-hardware/archive/9fc19be21f0807d6be092d70bf0b1de0c00ac895.tar.gz", - "hash": "03v7iby2sqj020san93ajk9aq4iyxkvnrr27k4cia0n6pl8f87rq" - }, - "nixpkgs": { - "type": "Channel", - "name": "nixos-unstable", - "url": "https://releases.nixos.org/nixos/unstable/nixos-24.11pre671089.d0e1602ddde6/nixexprs.tar.xz", - "hash": "08fh1nn216ldkcrflxggs752qbainm7va2l7ja45kjgkygaxffll" - }, - "nur": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "nix-community", - "repo": "NUR" - }, - "branch": "master", - "revision": "f835dd9bd11145dd8bc0a0fa820fb1672a1c9b7a", - "url": "https://github.com/nix-community/NUR/archive/f835dd9bd11145dd8bc0a0fa820fb1672a1c9b7a.tar.gz", - "hash": "000nkskhdjh2nph2asxf0a1xj8gs91qq8kpi5wmr8v0nr6lk8h12" - } - }, - "version": 3 -} \ No newline at end of file diff --git a/overlays/emacs.nix b/overlays/emacs.nix deleted file mode 100644 index ded36707..00000000 --- a/overlays/emacs.nix +++ /dev/null @@ -1 +0,0 @@ -import diff --git a/overlays/nur.nix b/overlays/nur.nix deleted file mode 100644 index 6f34f2aa..00000000 --- a/overlays/nur.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nur = import { pkgs = self; }; -} diff --git a/overlays/personal.nix b/overlays/personal.nix deleted file mode 100644 index 9eae64c4..00000000 --- a/overlays/personal.nix +++ /dev/null @@ -1,13 +0,0 @@ -self: super: -let - personal = import { - pkgs = self; - }; -in -{ - inherit personal; - enchant = personal.enchant-configurable.override { - withHspell = false; - withAspell = false; - }; -} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index b7d05d66..00000000 --- a/shell.nix +++ /dev/null @@ -1,20 +0,0 @@ -let - inherit (import ./sources.nix) nixPath sources; - - pkgs = import sources.nixpkgs { }; -in -pkgs.mkShell -{ - - name = "nixfiles-shell"; - - buildInputs = with pkgs; [ - npins - (pkgs.callPackage "${sources.agenix}/pkgs/agenix.nix" { }) - (import sources.home-manager { inherit pkgs; }).home-manager - ]; - - shellHook = '' - export NIX_PATH="${builtins.concatStringsSep ":" nixPath}"; - ''; -} diff --git a/sources.nix b/sources.nix deleted file mode 100644 index 8bcc5a4f..00000000 --- a/sources.nix +++ /dev/null @@ -1,15 +0,0 @@ -let - sources = import ./npins; - pkgs = import sources.nixpkgs { }; - inherit (import ./lib { inherit pkgs; }) mkNixPath fromSources; - - allSources = { - personal = ./packages; - nixpkgs-overlays = ./overlays; - private = ./private; - } // (fromSources sources); -in -{ - sources = allSources; - nixPath = mkNixPath allSources; -} diff --git a/system/linde.nix b/system/linde.nix index 730e0a14..db061e6d 100644 --- a/system/linde.nix +++ b/system/linde.nix @@ -18,20 +18,13 @@ let net-gw6 = "fe80::1"; domain = "alanpearce.eu"; ts-domain = "hydra-pinecone.ts.net"; - golink = (builtins.getFlake (toString )).nixosModules.default; in { imports = [ - - - - - golink # Include the results of the hardware scan. ./linde-hardware.nix - ./settings/pin.nix ./settings/services/git-server.nix ]; age.secrets = { @@ -323,9 +316,6 @@ in "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII8VIII+598QOBxi/52O1Kb19RdUdX0aZmS1/dNoyqc5 alan@hetzner.strongbox" ]; }; - home-manager = { - users.alan = import ../user/server.nix; - }; users.users.nixremote = { shell = "/bin/sh"; diff --git a/system/mba.nix b/system/mba.nix index b1a17922..ede4542d 100644 --- a/system/mba.nix +++ b/system/mba.nix @@ -3,7 +3,6 @@ ./settings/darwin.nix ./settings/dev.nix ./settings/programs/shell.nix - ]; services.caddy = { diff --git a/system/prefect.nix b/system/prefect.nix index e145c304..662c0144 100644 --- a/system/prefect.nix +++ b/system/prefect.nix @@ -25,11 +25,6 @@ ./settings/programs/docker.nix ./settings/dev.nix ./settings/gaming.nix - - - - - ]; virtualisation.vmVariant = { diff --git a/system/settings/configuration/nix.nix b/system/settings/configuration/nix.nix index b28fde18..105efaae 100644 --- a/system/settings/configuration/nix.nix +++ b/system/settings/configuration/nix.nix @@ -3,7 +3,6 @@ , pkgs , ... }: { - imports = [ ../pin.nix ]; nix = { settings = { cores = lib.mkDefault 0; diff --git a/system/settings/pin.nix b/system/settings/pin.nix deleted file mode 100644 index 533149fe..00000000 --- a/system/settings/pin.nix +++ /dev/null @@ -1,12 +0,0 @@ -let - inherit (import ../../sources.nix) nixPath sources; -in -{ - nix = { - inherit nixPath; - registry.nixpkgs.to = { - type = "path"; - path = sources.nixpkgs; - }; - }; -} diff --git a/user/mba.nix b/user/mba.nix index 890cda69..b76bdd74 100644 --- a/user/mba.nix +++ b/user/mba.nix @@ -13,8 +13,6 @@ ./settings/nixpkgs.nix ./settings/ssh.nix ./settings/user-interface.nix - - ]; home.username = "alan"; diff --git a/user/prefect.nix b/user/prefect.nix index 0a957d64..a15128bf 100644 --- a/user/prefect.nix +++ b/user/prefect.nix @@ -19,8 +19,6 @@ ./settings/ssh.nix ./settings/user-interface.nix ./settings/xresources.nix - - ]; home.username = "alan"; diff --git a/user/server.nix b/user/server.nix index 9b3db3fc..235e6908 100644 --- a/user/server.nix +++ b/user/server.nix @@ -9,7 +9,6 @@ ./settings/nix.nix ./settings/nixos.nix ./settings/development/base.nix - ]; home = { username = "alan"; diff --git a/user/settings/base.nix b/user/settings/base.nix index 5c5d6012..d202332b 100644 --- a/user/settings/base.nix +++ b/user/settings/base.nix @@ -1,4 +1,4 @@ -args@{ config +{ config , lib , pkgs , ... @@ -6,10 +6,7 @@ args@{ config imports = [ ./neovim.nix ./shell.nix - (import - (args // { databases = import ; })) ]; - # Let Home Manager install and manage itself. programs.home-manager.enable = true; manual = { diff --git a/user/settings/nix.nix b/user/settings/nix.nix index 66c00daf..94b28e52 100644 --- a/user/settings/nix.nix +++ b/user/settings/nix.nix @@ -20,7 +20,6 @@ in home.packages = with pkgs; [ cached-nix-shell nil - npins nix-prefetch-scripts nix-init nix-update @@ -33,7 +32,7 @@ in ]; xdg.configFile."nix-init/config.toml".source = toml.generate "config.toml" { maintainers = [ "alanpearce" ]; - nixpkgs = ""; + nixpkgs = "builtins.getFlake \"nixpkgs\""; }; programs.emacs.extraPackages = epkgs: (with epkgs; [ nix-mode diff --git a/user/settings/shell.nix b/user/settings/shell.nix index fe2b4690..0335e23e 100644 --- a/user/settings/shell.nix +++ b/user/settings/shell.nix @@ -129,7 +129,7 @@ in lw1 = "lorri watch --once"; lwo = "lorri watch --once"; - nsh = "nix-shell"; + nsh = "nix shell"; nb = "nix build"; nl = "nix log"; # shadows `coreutils.nl`, but I've never used that yet nr = "nix run"; -- cgit 1.4.1