diff --git a/README.md b/README.md index b39a4a7..ac094d2 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,22 @@ ## TODO 1. Add user specific traditional dotfiles. -2. Try home-manager for nix -3. Try nix flakes +2. Try home-manager for nix (Trying out right now) +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) diff --git a/Satori/pkgs.nix b/Satori/pkgs.nix index 1a2c9a6..c950cd7 100644 --- a/Satori/pkgs.nix +++ b/Satori/pkgs.nix @@ -2,7 +2,6 @@ { environment.systemPackages = with pkgs; [ - mpd_discord_richpresence customscripts xclip dunst diff --git a/flake.lock b/flake.lock index 9c8cdaf..ad1324d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "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": { "locked": { "lastModified": 1619464443, @@ -18,6 +38,7 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "nixpkgs": "nixpkgs", "stable": "stable" } diff --git a/flake.nix b/flake.nix index ecaa958..eff5e9f 100644 --- a/flake.nix +++ b/flake.nix @@ -2,26 +2,40 @@ inputs = { stable.url = "github:nixos/nixpkgs/nixos-20.09"; 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 system = "x86_64-linux"; in { - overlays = { - overridesandshit = import ./overlays/overridesandshit.nix; - packages = import ./overlays/packages.nix; - }; - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = builtins.attrValues self.overlays; + overlays = { + overridesandshit = import ./overlays/overridesandshit.nix; + packages = import ./overlays/packages.nix; + }; + + hm-configs = { + natto = home-manager.lib.homeManagerConfiguration { + configuration = { pkgs, lib, ... }: { + imports = [ ./home/natto.nix ]; + nixpkgs = { + overlays = builtins.attrValues self.overlays; + }; + }; + system = "${system}"; + homeDirectory = "/home/natto"; + username = "natto"; }; + }; + nixosConfigurations.Satori = nixpkgs.lib.nixosSystem { system = "${system}"; modules = [ ./Satori/configuration.nix - { nixpkgs.pkgs = self.pkgs; } + { nixpkgs.overlays = builtins.attrValues self.overlays; } ]; }; }; diff --git a/hm-switch b/hm-switch new file mode 100755 index 0000000..3f38a2c --- /dev/null +++ b/hm-switch @@ -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 + diff --git a/home/natto.nix b/home/natto.nix new file mode 100644 index 0000000..d0eff27 --- /dev/null +++ b/home/natto.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + nixpkgs = { + config = { + allowUnfree = true; + }; + }; + home = { + packages = with pkgs; [ + discord + customscripts + mpd_discord_richpresence + qbittorrent + ]; + }; +}