Switch to flake-parts modules for treefmt and devshell
This commit is contained in:
parent
0a37261ba5
commit
138a204f13
6 changed files with 112 additions and 81 deletions
|
@ -11,4 +11,3 @@ creation_rules:
|
||||||
- *vpn
|
- *vpn
|
||||||
- *vpn_ssh
|
- *vpn_ssh
|
||||||
- *builder
|
- *builder
|
||||||
|
|
||||||
|
|
8
Justfile
8
Justfile
|
@ -1,8 +0,0 @@
|
||||||
default:
|
|
||||||
home-manager switch --flake .#sudoer777
|
|
||||||
update:
|
|
||||||
nix flake update
|
|
||||||
backup:
|
|
||||||
home-manager switch --flake .#sudoer777 -b backup
|
|
||||||
man:
|
|
||||||
man home-configuration.nix
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Laptop configuration
|
# Laptop configuration
|
||||||
|
|
||||||
This is the Nix home-manager configuration for my laptop, allowing me to easily manage a user configuration that can quickly be reproduced on other machines. It is currently being used on a foreign distro (Fedora Asahi Remix), but I plan to switch to NixOS when time allows and make it reusable for other systems I am currently using.
|
This is the Nix home-manager configuration for my laptop, allowing me to easily manage a user configuration that can quickly be reproduced on other machines. It is currently being used on a foreign distro (Fedora Asahi Remix), but I plan to switch to NixOS when time allows and make it reusable for other systems I am currently using. It uses direnv to automatically load the environment for running commands for this Flake.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
50
flake.lock
generated
50
flake.lock
generated
|
@ -1,5 +1,23 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"devshell": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1741473158,
|
||||||
|
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
|
@ -127,9 +145,7 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"flakey-profile": "flakey-profile",
|
"flakey-profile": "flakey-profile",
|
||||||
"lix": [
|
"lix": "lix",
|
||||||
"lix"
|
|
||||||
],
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
@ -168,6 +184,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722073938,
|
||||||
|
"narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1749776303,
|
"lastModified": 1749776303,
|
||||||
"narHash": "sha256-OHibOvVwKqO1qvRg0r3agtd1EagW4THBcoWT7QGgcNo=",
|
"narHash": "sha256-OHibOvVwKqO1qvRg0r3agtd1EagW4THBcoWT7QGgcNo=",
|
||||||
|
@ -183,7 +215,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1749285348,
|
"lastModified": 1749285348,
|
||||||
"narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=",
|
"narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=",
|
||||||
|
@ -199,7 +231,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_4": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1747958103,
|
"lastModified": 1747958103,
|
||||||
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
|
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
|
||||||
|
@ -218,7 +250,7 @@
|
||||||
"nur": {
|
"nur": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts_2",
|
"flake-parts": "flake-parts_2",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_3",
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -237,12 +269,12 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"devshell": "devshell",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"lix": "lix",
|
|
||||||
"lix-module": "lix-module",
|
"lix-module": "lix-module",
|
||||||
"nixgl": "nixgl",
|
"nixgl": "nixgl",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
"treefmt-nix": "treefmt-nix_2"
|
"treefmt-nix": "treefmt-nix_2"
|
||||||
|
@ -306,7 +338,7 @@
|
||||||
},
|
},
|
||||||
"treefmt-nix_2": {
|
"treefmt-nix_2": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": "nixpkgs_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750931469,
|
"lastModified": 1750931469,
|
||||||
|
|
60
flake.nix
60
flake.nix
|
@ -2,6 +2,7 @@
|
||||||
{
|
{
|
||||||
description = "Home Manager configuration";
|
description = "Home Manager configuration";
|
||||||
inputs = {
|
inputs = {
|
||||||
|
devshell.url = "github:numtide/devshell";
|
||||||
flake-parts = {
|
flake-parts = {
|
||||||
url = "github:hercules-ci/flake-parts";
|
url = "github:hercules-ci/flake-parts";
|
||||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
|
@ -10,14 +11,9 @@
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
lix = {
|
|
||||||
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
lix-module = {
|
lix-module = {
|
||||||
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
inputs.lix.follows = "lix";
|
|
||||||
};
|
};
|
||||||
nixgl = {
|
nixgl = {
|
||||||
url = "github:nix-community/nixGL";
|
url = "github:nix-community/nixGL";
|
||||||
|
@ -40,20 +36,17 @@
|
||||||
systems = [ "aarch64-linux" ];
|
systems = [ "aarch64-linux" ];
|
||||||
imports = [
|
imports = [
|
||||||
inputs.home-manager.flakeModules.home-manager
|
inputs.home-manager.flakeModules.home-manager
|
||||||
|
inputs.treefmt-nix.flakeModule
|
||||||
|
inputs.devshell.flakeModule
|
||||||
# ./home/flake-module.nix
|
# ./home/flake-module.nix
|
||||||
];
|
];
|
||||||
flake = {
|
flake = {
|
||||||
homeConfigurations = {
|
homeConfigurations = {
|
||||||
asahi = withSystem "aarch64-linux" (
|
asahi = withSystem "aarch64-linux" (
|
||||||
ctx@{
|
{ pkgs, ... }:
|
||||||
config,
|
|
||||||
inputs',
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
inputs.home-manager.lib.homeManagerConfiguration {
|
inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
extraSpecialArgs = { inherit inputs inputs' pkgs; };
|
extraSpecialArgs = { inherit inputs pkgs; };
|
||||||
modules = [
|
modules = [
|
||||||
./home/home.nix
|
./home/home.nix
|
||||||
inputs.lix-module.nixosModules.default
|
inputs.lix-module.nixosModules.default
|
||||||
|
@ -65,7 +58,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
perSystem =
|
perSystem =
|
||||||
{ self', system, ... }:
|
{ system, config, ... }:
|
||||||
let
|
let
|
||||||
pkgs = import inputs.nixpkgs {
|
pkgs = import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
@ -74,32 +67,47 @@
|
||||||
inputs.nixgl.overlays.default
|
inputs.nixgl.overlays.default
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
|
||||||
treefmtWrapper = treefmtEval.config.build.wrapper;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
_module.args.pkgs = pkgs;
|
_module.args.pkgs = pkgs;
|
||||||
_module.args.treefmtEval = treefmtEval;
|
devshells.default = {
|
||||||
devShells.default = pkgs.mkShell {
|
commands = [
|
||||||
buildInputs = [
|
{
|
||||||
inputs.lix.outPath
|
help = "`home-manager switch` for asahi";
|
||||||
inputs.sops-nix.nixosModules.sops
|
name = "switch-asahi";
|
||||||
|
command = "home-manager switch --flake .#asahi";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
help = "`home-manager switch` for asahi with backup";
|
||||||
|
name = "switch-asahi-backup";
|
||||||
|
command = "home-manager switch --flake .#asahi -b backup";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
help = "update dependencies";
|
||||||
|
name = "update";
|
||||||
|
command = "nix flake update";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
help = "show home-manager documentation";
|
||||||
|
name = "man-home";
|
||||||
|
command = "man home-configuration.nix";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
packages = [
|
||||||
|
config.treefmt.build.wrapper
|
||||||
pkgs.age
|
pkgs.age
|
||||||
pkgs.forgejo-cli
|
pkgs.forgejo-cli
|
||||||
pkgs.helix
|
pkgs.helix
|
||||||
pkgs.just
|
pkgs.lix
|
||||||
pkgs.marksman
|
pkgs.marksman
|
||||||
pkgs.nil
|
pkgs.nil
|
||||||
|
pkgs.sops
|
||||||
pkgs.taplo
|
pkgs.taplo
|
||||||
pkgs.uutils-coreutils
|
pkgs.uutils-coreutils
|
||||||
pkgs.yaml-language-server
|
pkgs.yaml-language-server
|
||||||
treefmtWrapper
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
# formatter.${system} = treefmtWrapper;
|
treefmt = ./treefmt.nix;
|
||||||
# checks.${system} = {
|
|
||||||
# formatting = treefmtEval.config.build.check self;
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue