From 37b5eafb42043a7ea6a32552dbbff8dfb814b955 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Thu, 21 Sep 2023 11:10:43 +0200 Subject: [PATCH] nix: use unstable and add home-manager --- nix/configuration.nix | 25 ++++++++++++++++--------- nix/flake.lock | 42 ++++++++++++++++++++++++------------------ nix/flake.nix | 23 +++++++++-------------- nix/home.nix | 26 ++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 41 deletions(-) create mode 100644 nix/home.nix diff --git a/nix/configuration.nix b/nix/configuration.nix index 60d0625..404c096 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -2,14 +2,22 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: +{ inputs, config, pkgs, ... }: let python-packages = ps: with ps; [ ]; in rec { - imports = [ # Include the results of the hardware scan. + imports = [ ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager ]; + home-manager = { + extraSpecialArgs = { inherit inputs; }; + useGlobalPkgs = true; + useUserPackages = true; + users.julian = import ./home.nix; + }; + # Bootloader # Use this for simple nix boot menu, if no dual boot required boot.loader.systemd-boot.enable = true; @@ -84,7 +92,7 @@ in rec { services.xserver.windowManager.i3.extraPackages = with pkgs; [ rofi i3lock - unstable.i3status-rust + i3status-rust nitrogen ]; @@ -140,7 +148,7 @@ in rec { makemkv audacity gnome.cheese - unstable.zoom-us + zoom-us qutebrowser unetbootin @@ -152,6 +160,8 @@ in rec { ]; }; + programs.zsh.enable = true; + users.groups.julian = { gid = 1000; }; # users.groups.wolfi = { gid = 1001; }; @@ -166,9 +176,7 @@ in rec { # Allow unfree packages nixpkgs.config.allowUnfree = true; - # nixpkgs.config.packageOverrides = pkgs: { - # unstable = import { config = config.nixpkgs.config; }; - # }; + nixpkgs.config.nvidia.acceptLicense = true; environment.etc."manual-links/xfce4-notifyd".source = "${pkgs.xfce.xfce4-notifyd}/lib/xfce4/notifyd/xfce4-notifyd"; @@ -257,7 +265,6 @@ in rec { python3 black libnotify - # unstable.tor-browser-bundle-bin libclang libreoffice killall @@ -326,7 +333,7 @@ in rec { }) ]; - fonts.fonts = with pkgs; [ + fonts.packages = with pkgs; [ (nerdfonts.override { fonts = [ "FiraCode" ]; }) font-awesome dejavu_fonts diff --git a/nix/flake.lock b/nix/flake.lock index 97b9c09..ea34b26 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -16,6 +16,26 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1695224363, + "narHash": "sha256-+hfjJLUMck5G92RVFDZA7LWkR3kOxs5zQ7RPW9t3eM8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "408ba13188ff9ce309fa2bdd2f81287d79773b00", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nix-matlab": { "inputs": { "flake-compat": "flake-compat", @@ -49,7 +69,7 @@ "type": "indirect" } }, - "nixpkgs-unstable": { + "nixpkgs_2": { "locked": { "lastModified": 1694959747, "narHash": "sha256-CXQ2MuledDVlVM5dLC4pB41cFlBWxRw4tCBsFrq3cRk=", @@ -59,31 +79,17 @@ "type": "github" }, "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1688392541, - "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", - "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-22.11", - "type": "indirect" } }, "root": { "inputs": { + "home-manager": "home-manager", "nix-matlab": "nix-matlab", - "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs": "nixpkgs_2" } } }, diff --git a/nix/flake.nix b/nix/flake.nix index 880091b..f85d8ad 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -1,29 +1,24 @@ { - inputs.nixpkgs.url = "nixpkgs/nixos-22.11"; - inputs.nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; inputs.nix-matlab.url = "gitlab:doronbehar/nix-matlab"; # inputs.home-manager.url = "github:nix-community/home-manager"; - outputs = { self, nixpkgs, nixpkgs-unstable, nix-matlab, ... }@attrs: + outputs = { self, nixpkgs, home-manager, nix-matlab, ... }@inputs: let system = "x86_64-linux"; - overlay-unstable = final: prev: { - # unstable = nixpkgs-unstable.legacyPackages.${prev.system}; - # use this variant if unfree packages are needed: - unstable = import nixpkgs-unstable { - inherit system; - config.allowUnfree = true; - }; - }; in { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = attrs; + # inherit system; + specialArgs = { inherit inputs system; }; modules = [ # Overlays-module makes "pkgs.unstable" available in configuration.nix ({ config, pkgs, ... }: { - nixpkgs.overlays = [ overlay-unstable nix-matlab.overlay ]; + nixpkgs.overlays = [ nix-matlab.overlay ]; }) ./configuration.nix ]; diff --git a/nix/home.nix b/nix/home.nix new file mode 100644 index 0000000..2b84b31 --- /dev/null +++ b/nix/home.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "julian"; + home.homeDirectory = "/home/julian"; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "23.05"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.packages = [ + # pkgs.cowsay + ]; + +}