From 47eb5f65686c00e63b88586b932ff47b9bb81c16 Mon Sep 17 00:00:00 2001 From: Kyle Brown Date: Sat, 28 Oct 2023 12:25:01 -0700 Subject: [PATCH] fix: cleanup --- README.md | 32 +++++-- common/darwin/fonts.nix | 2 + common/editors/emacs.nix | 3 + flake.lock | 192 ++++++++++++++++++++++++--------------- flake.nix | 6 +- justfile | 8 +- 6 files changed, 154 insertions(+), 89 deletions(-) diff --git a/README.md b/README.md index a61dc66..d314d71 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,38 @@ # My nix configurations -This repo has my personal configuration for [NixOS](https://nixos.org) and [nix-darwin](https://github.com/LnL7/nix-darwin), including a cross-platform [home-manager](https://nix-community.github.io/home-manager/) configuration used by both. +This repo has my personal configuration for [NixOS](https://nixos.org) and +[nix-darwin](https://github.com/LnL7/nix-darwin), including a cross-platform +[home-manager](https://nix-community.github.io/home-manager/) configuration used +by both. + +Refactored from my old config using [Misterio77's awesome starter +template](https://github.com/Misterio77/nix-starter-configs) as a starting +point. Also borrowed from +[Yusuefnapora](https://github.com/yusefnapora/nix-config/tree/main) for much of +this. -Refactored from my old config using [Misterio77's awesome starter template](https://github.com/Misterio77/nix-starter-configs) as a starting point. Also borrowed from [Yusuefnapora](https://github.com/yusefnapora/nix-config/tree/main) for much of this. ## Structure - `flake.nix`: flake entrypoint -- `darwin`: nix-darwin host configurations +- `hosts`: host configurations - `home-manager`: home-manager configurations & features -- `modules`: nixos and home-manager modules that could potentially be upstreamed -- `nixos`: NixOS host configurations & features -- `overlays`: nixpkgs overlays, including local packages & nixpkgs-unstable +- `nixos`: NixOS configurations & features - `pkgs`: local packages that could potentially be upstreamed to nixpkgs +- `common`: shared files between more than one host +- `modules`: nixos and home-manager modules that could potentially be upstreamed ## Usage -The `justfile` defines a few recipies using the [just](https://github.com/casey/just) command runner. Run `just --list` to list all recipies. The most important are `just switch`, which builds the config (for the current hostname by default) and switches to it, `just build` which builds but doesn't switch, and `just trace`, which prints the stacktrace when things fail to build. +The `justfile` defines a few recipies using the +[just](https://github.com/casey/just) command runner. Run `just --list` to list +all recipies. The most important are `just switch`, which builds the config (for +the current hostname by default) and switches to it, `just build` which builds +but doesn't switch, and `just trace`, which prints the stacktrace when things +fail to build. + + +If you don't have `just` installed but do have nix, run `nix develop` to open a +bootstrap shell environment. -If you don't have `just` installed but do have nix, run `nix develop` to open a bootstrap shell environment. diff --git a/common/darwin/fonts.nix b/common/darwin/fonts.nix index 9099e79..5fb7032 100644 --- a/common/darwin/fonts.nix +++ b/common/darwin/fonts.nix @@ -5,6 +5,7 @@ "JetBrainsMono" "FantasqueSansMono" "Iosevka" + "Meslo" ]; in { fonts = { @@ -21,6 +22,7 @@ in { powerline-fonts liberation_ttf iosevka + meslo-lgs-nf # p10k ; }; }; diff --git a/common/editors/emacs.nix b/common/editors/emacs.nix index 17c7db7..1389fb8 100644 --- a/common/editors/emacs.nix +++ b/common/editors/emacs.nix @@ -10,4 +10,7 @@ enable = true; package = pkgs.emacs; # replace with emacs-gtk, or a version provided by the community overlay if desired. }; + environment.systemPackages = with pkgs; [ + prettier + ]; } diff --git a/flake.lock b/flake.lock index 7407430..527c03b 100644 --- a/flake.lock +++ b/flake.lock @@ -85,27 +85,6 @@ "type": "github" } }, - "firefox-addons": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "dir": "pkgs/firefox-addons", - "lastModified": 1698437350, - "narHash": "sha256-CmgdLeRdxwxbYhmOd248Xv7ST9nQv+bRcpdqba5bWMc=", - "owner": "rycee", - "repo": "nur-expressions", - "rev": "306a80be9aac9aa7b257f7ec105902e0a4f75b81", - "type": "gitlab" - }, - "original": { - "dir": "pkgs/firefox-addons", - "owner": "rycee", - "repo": "nur-expressions", - "type": "gitlab" - } - }, "flake-compat": { "locked": { "lastModified": 1688025799, @@ -137,6 +116,22 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -156,21 +151,6 @@ } }, "flake-utils_2": { - "locked": { - "lastModified": 1629284811, - "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { "inputs": { "systems": "systems_3" }, @@ -188,7 +168,7 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_3": { "inputs": { "systems": "systems_4" }, @@ -206,6 +186,24 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -228,6 +226,27 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -251,7 +270,7 @@ "hyprland": { "inputs": { "hyprland-protocols": "hyprland-protocols", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "systems": "systems_2", "wlroots": "wlroots", "xdph": "xdph" @@ -343,6 +362,22 @@ "type": "github" } }, + "nixpkgs-stable_3": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1698318101, @@ -360,22 +395,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1627814220, - "narHash": "sha256-P+MDgdZw2CBk9X1ZZaUgHgN+32pTfLFf3XVIBOXirI4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "ab5b6828af26215bf2646c31961da5d3749591ef", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1698134075, "narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=", @@ -391,7 +410,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1698318101, "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=", @@ -410,7 +429,7 @@ "nixvim": { "inputs": { "beautysh": "beautysh", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs-unstable" ], @@ -430,21 +449,6 @@ "type": "github" } }, - "nur": { - "locked": { - "lastModified": 1698437998, - "narHash": "sha256-FIqzVjnwh7EgVFzrMKo7iqvud+YbPjCOvSD3t/In1iI=", - "owner": "nix-community", - "repo": "nur", - "rev": "8fceb8a24c6494d03dc909cb55a6f9f0fd086b00", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nur", - "type": "github" - } - }, "poetry2nix": { "inputs": { "flake-utils": [ @@ -475,7 +479,7 @@ "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_3", "gitignore": "gitignore", "nixpkgs": [ "nixvim", @@ -497,18 +501,41 @@ "type": "github" } }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_4", + "gitignore": "gitignore_2", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_3" + }, + "locked": { + "lastModified": 1698227354, + "narHash": "sha256-Fi5H9jbaQLmLw9qBi/mkR33CoFjNbobo5xWdX4tKz1Q=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "bd38df3d508dfcdff52cd243d297f218ed2257bf", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "apple-silicon": "apple-silicon", "darwin": "darwin", "emacs": "emacs", - "firefox-addons": "firefox-addons", "home-manager": "home-manager", "hyprland": "hyprland", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim", - "nur": "nur" + "pre-commit-hooks": "pre-commit-hooks_2" } }, "rust-overlay": { @@ -587,6 +614,21 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1678901627, diff --git a/flake.nix b/flake.nix index 15f26e5..80bfa7a 100644 --- a/flake.nix +++ b/flake.nix @@ -23,13 +23,15 @@ url = "github:pta2002/nixvim"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; - nur.url = "github:nix-community/nur"; - firefox-addons.url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; hyprland.url = "github:hyprwm/Hyprland"; emacs = { url = "github:nix-community/emacs-overlay"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { diff --git a/justfile b/justfile index 1c44e57..203efbc 100644 --- a/justfile +++ b/justfile @@ -5,7 +5,7 @@ hostname := `hostname | cut -d "." -f 1` # Build the nix-darwin system configuration without switching to it [macos] -build target_host=hostname flags="": && hm-build +build target_host=hostname flags="": @echo "Building nix-darwin config..." nix --extra-experimental-features 'nix-command flakes' build ".#darwinConfigurations.{{target_host}}.system" {{flags}} @@ -15,7 +15,7 @@ trace target_host=hostname: (build target_host "--show-trace") # Build the nix-darwin configuration and switch to it [macos] -switch target_host=hostname: (build target_host) hm-switch +switch target_host=hostname: (build target_host) @echo "switching to new config for {{target_host}}" # if macOS updates and overwrites /etc/shells, nix will refuse to update it sudo mv /etc/shells /tmp/shells.bak @@ -32,7 +32,7 @@ rebuild_flags := `if [ -d /boot/asahi ]; then echo "--impure"; else echo ""; fi` # Build the NixOS configuration without switching to it [linux] -build target_host=hostname flags="": && hm-build +build target_host=hostname flags="": nixos-rebuild build --flake .#{{target_host}} {{rebuild_flags}} {{flags}} # Build the NixOS config with the --show-trace flag set @@ -41,7 +41,7 @@ trace target_host=hostname: (build target_host "--show-trace") # Build the NixOS configuration and switch to it. [linux] -switch target_host=hostname: && hm-switch +switch target_host=hostname: sudo nixos-rebuild switch --flake .#{{target_host}} {{rebuild_flags}} # Update flake inputs to their latest revisions