home-manager initial commit

This commit is contained in:
2021-04-30 19:49:57 +05:30
parent fb7e5cafce
commit da3ef21ccd
6 changed files with 100 additions and 13 deletions

View File

@@ -2,5 +2,22 @@
## TODO ## TODO
1. Add user specific traditional dotfiles. 1. Add user specific traditional dotfiles.
2. Try home-manager for nix 2. Try home-manager for nix (Trying out right now)
3. Try nix flakes 3. ~~Try nix flakes~~
## How install workey
```
git clone https://github.com/natto1784/dotfiles
cd dotfiles
nixos-rebuild switch --flake .
```
## How home-manager workey
Either clone repo and do `./hm-switch` inside it (ofc change the username in the flake to yours dum dum)\
or
```
nix build github:natto1784/dotfiles#hm-configs.{USER}.activationPackage -o allah
./allah/activate
```
You can unlink allah afterwards
(replace {USER} with 'natto' or whatever username there is in flake.nix, retard)

View File

@@ -2,7 +2,6 @@
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
mpd_discord_richpresence
customscripts customscripts
xclip xclip
dunst dunst

21
flake.lock generated
View File

@@ -1,5 +1,25 @@
{ {
"nodes": { "nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1619711895,
"narHash": "sha256-CWc6RAoqHSX7vhRqMbd1K1oULO7fy3IJ6o+J9zkHtcI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d57c59e7cb4beba06825c042df35cc1f707bb41a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1619464443, "lastModified": 1619464443,
@@ -18,6 +38,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"stable": "stable" "stable": "stable"
} }

View File

@@ -2,8 +2,12 @@
inputs = { inputs = {
stable.url = "github:nixos/nixpkgs/nixos-20.09"; stable.url = "github:nixos/nixpkgs/nixos-20.09";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs@{self, nixpkgs, stable,... }: };
outputs = inputs@{self, nixpkgs, stable, home-manager,... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
in in
@@ -12,16 +16,26 @@
overridesandshit = import ./overlays/overridesandshit.nix; overridesandshit = import ./overlays/overridesandshit.nix;
packages = import ./overlays/packages.nix; packages = import ./overlays/packages.nix;
}; };
pkgs = import nixpkgs {
inherit system; hm-configs = {
config.allowUnfree = true; natto = home-manager.lib.homeManagerConfiguration {
configuration = { pkgs, lib, ... }: {
imports = [ ./home/natto.nix ];
nixpkgs = {
overlays = builtins.attrValues self.overlays; overlays = builtins.attrValues self.overlays;
}; };
};
system = "${system}";
homeDirectory = "/home/natto";
username = "natto";
};
};
nixosConfigurations.Satori = nixpkgs.lib.nixosSystem { nixosConfigurations.Satori = nixpkgs.lib.nixosSystem {
system = "${system}"; system = "${system}";
modules = [ modules = [
./Satori/configuration.nix ./Satori/configuration.nix
{ nixpkgs.pkgs = self.pkgs; } { nixpkgs.overlays = builtins.attrValues self.overlays; }
]; ];
}; };
}; };

19
hm-switch Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
echo "You're about to switch your home-manager configuration as '$USER'"
read -p "Continue (y/n)?" conf
read -p "Do you want to use doas instead of sudo? (y/n)" conf2
elev="sudo"
if [ ${conf2,,} == "y" ]; then
elev="doas"
fi
if [ ${conf,,} == "n" ]; then
echo "If this is not you, then log into your profile first!"
exit 1
else
$elev nix build .\#hm-configs.$USER.activationPackage -o hm-result
./hm-result/activate
$elev unlink hm-result
fi

17
home/natto.nix Normal file
View File

@@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
nixpkgs = {
config = {
allowUnfree = true;
};
};
home = {
packages = with pkgs; [
discord
customscripts
mpd_discord_richpresence
qbittorrent
];
};
}