refactor: migrate home-manager configs to flakes

This commit is contained in:
Harsh Shandilya 2022-11-23 20:14:12 +05:30
parent 4d2a3f9a60
commit eadfa1edca
No known key found for this signature in database
6 changed files with 130 additions and 25 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.lock linguist-generated

86
flake.lock generated Normal file
View File

@ -0,0 +1,86 @@
{
"nodes": {
"custom-nixpkgs": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1669213025,
"narHash": "sha256-4pMMNgRkIiY6bvXIUyANWEOJpkRgUEEwBaGYrX1h/EQ=",
"owner": "msfjarvis",
"repo": "custom-nixpkgs",
"rev": "b8235de54d00a89678d3dd32c5ff5cfee47645e5",
"type": "github"
},
"original": {
"owner": "msfjarvis",
"ref": "main",
"repo": "custom-nixpkgs",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1669071065,
"narHash": "sha256-KBpgj3JkvlPsJ3duOZqFJe6tgr+wc75t8sFmgRbBSbw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f7641a3ff398ccce952e19a199d775934e518c1d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1669140675,
"narHash": "sha256-npzfyfLECsJWgzK/M4gWhykP2DNAJTYjgY2BWkz/oEQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2788904d26dda6cfa1921c5abb7a2466ffe3cb8c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"custom-nixpkgs": "custom-nixpkgs",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

38
flake.nix Normal file
View File

@ -0,0 +1,38 @@
{
description = "Home Manager configurations of Harsh Shandilya";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
custom-nixpkgs = {
url = "github:msfjarvis/custom-nixpkgs/main";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, custom-nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
packageOverrides = pkgs: {
custom = import custom-nixpkgs { inherit pkgs; };
};
};
};
in {
homeConfigurations.ryzenbox = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./nixos/ryzenbox-configuration.nix ];
};
homeConfigurations.server = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./nixos/server-configuration.nix ];
};
};
}

View File

@ -1,15 +1,8 @@
{ config, pkgs, ... }:
let
customTarball = fetchTarball
"https://github.com/msfjarvis/custom-nixpkgs/archive/e6ce40c3e84d005d723d6aa6c26d841d6f5e677e.tar.gz";
in {
{
home.username = "msfjarvis";
home.homeDirectory = "/home/msfjarvis";
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: { custom = import customTarball { }; };
};
fonts.fontconfig.enable = true;

View File

@ -1,15 +1,8 @@
{ config, pkgs, ... }:
let
customTarball = fetchTarball
"https://github.com/msfjarvis/custom-nixpkgs/archive/e6ce40c3e84d005d723d6aa6c26d841d6f5e677e.tar.gz";
in {
{
home.username = "msfjarvis";
home.homeDirectory = "/home/msfjarvis";
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: { custom = import customTarball { }; };
};
programs.aria2 = { enable = true; };

12
x
View File

@ -47,22 +47,16 @@ case "${1:-nothing}" in
set +x
;;
home-check)
nix-channel --update
cp nixos/ryzenbox-configuration.nix ~/.config/nixpkgs/home.nix
home-manager build --show-trace
home-manager build --flake .#ryzenbox
;;
home-switch)
nix-channel --update
cp nixos/ryzenbox-configuration.nix ~/.config/nixpkgs/home.nix
home-manager switch
home-manager switch --flake .#ryzenbox
;;
install)
./install.sh
;;
server-switch)
nix-channel --update
cp nixos/server-configuration.nix ~/.config/nixpkgs/home.nix
home-manager switch
home-manager switch --flake .#server
;;
test | nothing)
shfmt -d -s -i 2 -ci "${SCRIPTS_TO_TEST[@]}"