diff --git a/flake.lock b/flake.lock index 05ed3b7..177441e 100644 --- a/flake.lock +++ b/flake.lock @@ -37,27 +37,10 @@ "type": "github" } }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 062aeb4..2581a7d 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,8 @@ description = "Sneexy's custom nixos configs"; inputs = { + # TODO: dear god there is a lot here. can we remove some? or try to split them? + # nixpkgs from the unstable branch. since stable is a bit too dated # for my personal taste nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; @@ -22,6 +24,9 @@ # packages, such as modified linux kernels (which we do use here) chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; + # flake that allows for installing system and user flatpaks + nix-flatpak.url = "github:gmodena/nix-flatpak"; + # catppuccin's nix thingy for theming applications with catppuccin directly inside # of the config catppuccin.url = "github:catppuccin/nix"; @@ -56,6 +61,7 @@ nixpkgs, nixpkgs-master, chaotic, + nix-flatpak, catppuccin, home-manager, plasma-manager, @@ -64,86 +70,64 @@ ... } @ inputs: let inherit (self) outputs; - # our systems are all x86_64 unfortunately - systems = [ - "x86_64-linux" - ]; - # This is a function that generates an attribute by calling a function you - # pass to it, with each system as an argument - forAllSystems = nixpkgs.lib.genAttrs systems; in { - # Your custom packages - # Accessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); - # Formatter for your nix files, available through 'nix fmt' - # Other options beside 'alejandra' include 'nixpkgs-fmt' - formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); - - # Your custom packages and modifications, exported as overlays - overlays = import ./overlays {inherit inputs;}; - # Reusable nixos modules you might want to export - # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; + nixosModules = { + declarativeHome = { ... }: { + # thanks to https://determinate.systems/posts/declarative-gnome-configuration-with-nixos for teaching how to use this home manager module + imports = [ home-manager.nixosModules.home-manager ]; + config = { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + }; + }; + defaults = { ... }: { + # globally allow unfree packages + nixpkgs.config.allowUnfree = true; + # flakes, duh + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + }; + }; # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - # main laptop i use daily + # my main laptop, a thinkpad t480 "thunkpad" = nixpkgs.lib.nixosSystem rec { - specialArgs = {inherit inputs outputs;}; - modules = [ - # specific configs for thunkpad/t480 + # boowomp sound effect + system = "x86_64-linux"; + specialArgs = { + inherit inputs outputs; + pkgs-master = nixpkgs-master.legacyPackages.${system}; + }; + modules = with self.nixosModules; [ ./machines/thunkpad - # shared/common config - ./nixos/configuration.nix - # fingerprint modules - nixos-06cb-009a-fingerprint-sensor.nixosModules.open-fprintd - nixos-06cb-009a-fingerprint-sensor.nixosModules.python-validity + declarativeHome ./users/ruben + # flatpaks + nix-flatpak.nixosModules.nix-flatpak # nyx repo chaotic.nixosModules.default ]; }; - # secondary 2 in 1 device, not really used - "thonkpad" = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - # nixos configuration file (and others) for thonkpad + # my secondary laptop, a thinkpad yoga 14...? + "thonkpad" = nixpkgs.lib.nixosSystem rec { + # boowomp sound effect x2 + system = "x86_64-linux"; + specialArgs = { + inherit inputs outputs; + pkgs-master = nixpkgs-master.legacyPackages.${system}; + }; + modules = with self.nixosModules; [ ./machines/thonkpad - # shared/common config - ./nixos/configuration.nix + declarativeHome ./users/ruben + # flatpaks + nix-flatpak.nixosModules.nix-flatpak # nyx repo chaotic.nixosModules.default ]; }; }; - - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - # TODO: theres probably a better way to do this/specify one home config for all devices - # main device - "ruben@thunkpad" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home-manager/home.nix - # cat cat cat meow 🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛ - catppuccin.homeManagerModules.catppuccin - ]; - }; - # secondary device - "ruben@thonkpad" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home-manager/home.nix - # cat cat cat meow 🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛🐈‍⬛ - catppuccin.homeManagerModules.catppuccin - ]; - }; - }; }; } diff --git a/machines/thonkpad/default.nix b/machines/thonkpad/default.nix index 741c2f5..fc89d97 100644 --- a/machines/thonkpad/default.nix +++ b/machines/thonkpad/default.nix @@ -8,6 +8,8 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + # use shared configuration + ../../nixos.nix ]; # who up thonking they diff --git a/machines/thunkpad/default.nix b/machines/thunkpad/default.nix index e381da2..e9ec770 100644 --- a/machines/thunkpad/default.nix +++ b/machines/thunkpad/default.nix @@ -8,6 +8,8 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + # use shared configuration + ../../nixos.nix ]; # who up thunking they diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix deleted file mode 100644 index 45aae31..0000000 --- a/modules/home-manager/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). -# These should be stuff you would like to share with others, not your personal configurations. -{ - # List your module files here - # my-module = import ./my-module.nix; -} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix deleted file mode 100644 index 8605069..0000000 --- a/modules/nixos/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). -# These should be stuff you would like to share with others, not your personal configurations. -{ - # List your module files here - # my-module = import ./my-module.nix; -} diff --git a/nixos/configuration.nix b/nixos.nix similarity index 97% rename from nixos/configuration.nix rename to nixos.nix index d067410..1ea1567 100644 --- a/nixos/configuration.nix +++ b/nixos.nix @@ -19,18 +19,12 @@ # You can also split up your configuration and import pieces of it here: # ./users.nix - - # specify users in a seperate config file (since its only me on this system, anyways) - ./users.nix ]; nixpkgs = { # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default diff --git a/overlays/default.nix b/overlays/default.nix deleted file mode 100644 index a13ea3c..0000000 --- a/overlays/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -# This file defines overlays -{inputs, ...}: { - # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs {pkgs = final;}; - - # This one contains whatever you want to overlay - # You can change versions, add patches, set compilation flags, anything really. - # https://nixos.wiki/wiki/Overlays - modifications = final: prev: { - # example = prev.example.overrideAttrs (oldAttrs: rec { - # ... - # }); - }; - - # When applied, the unstable nixpkgs set (declared in the flake inputs) will - # be accessible through 'pkgs.unstable' - unstable-packages = final: _prev: { - unstable = import inputs.nixpkgs-unstable { - system = final.system; - config.allowUnfree = true; - }; - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix deleted file mode 100644 index 3d9e23c..0000000 --- a/pkgs/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -# Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' -pkgs: { - # example = pkgs.callPackage ./example { }; -} diff --git a/nixos/users.nix b/users/ruben/default.nix similarity index 87% rename from nixos/users.nix rename to users/ruben/default.nix index 6bd9ca5..3b62d9f 100644 --- a/nixos/users.nix +++ b/users/ruben/default.nix @@ -2,7 +2,7 @@ { config, pkgs, lib, ... }: { - home-manager.users.ruben = ../home-manager/home.nix; + home-manager.users.ruben = ./home.nix; # myself :D users.users."ruben" = { @@ -10,6 +10,7 @@ description = "Ruben"; shell = pkgs.zsh; extraGroups = [ "wheel" "plugdev" "dialout" "libvirtd" ] ++ (lib.optional config.networking.networkmanager.enable "networkmanager"); + initialHashedPassword = "changeme"; openssh.authorizedKeys.keys = [ ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO+V3b6oKMTLEBq8AKjdNF5ZwJGXuWTrS2u9QaEypBYP sneexy@disroot.org'' ]; }; diff --git a/home-manager/home.nix b/users/ruben/home.nix similarity index 75% rename from home-manager/home.nix rename to users/ruben/home.nix index 6e94a05..51aa7f1 100644 --- a/home-manager/home.nix +++ b/users/ruben/home.nix @@ -2,7 +2,6 @@ # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) { inputs, - outputs, lib, config, pkgs, @@ -10,11 +9,11 @@ }: { # You can import other home-manager modules here imports = [ - # If you want to use modules your own flake exports (from modules/home-manager): - # outputs.homeManagerModules.example + # import the flatpaks home-manager nix + flatpaks.homeManagerModules.nix-flatpak - # Or modules exported from other flakes (such as nix-colors): - # inputs.nix-colors.homeManagerModules.default + # If you want to use home-manager modules from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModule # You can also split up your configuration and import pieces of it here: # ./nvim.nix @@ -23,12 +22,7 @@ nixpkgs = { # You can add overlays here overlays = [ - # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages - - # You can also add overlays exported from other flakes: + # If you want to use overlays exported from other flakes: # neovim-nightly-overlay.overlays.default # Or define it inline, for example: @@ -52,13 +46,61 @@ homeDirectory = "/home/ruben"; }; - # catppuccin flavour - catppuccin.flavour = "mocha"; + # Add stuff for your user as you see fit: + programs.neovim.enable = true; + home.packages = with pkgs; [ + btop + bat + duf + fastfetch + fd + delta + lsd + ripgrep + sd + starship + zoxide - # this is a got damn NEO VIMME HOUSE !! - home.sessionVariables = { - EDITOR = "nvim"; - }; + usbutils + jq + ffmpeg_6-full + imagemagick + yt-dlp + + firefox + thunderbird + birdtray + libreoffice + inkscape gimp + kdenlive krita + nicotine-plus + okteta + obsidian + obs-studio + gpu-screen-recorder-gtk + + gajim + cinny-desktop + revolt-desktop + vesktop + signal-desktop + + cartridges + prismlauncher + retroarch-with-cores + pcsx2 + dolphin-emu + dosbox-staging + bottles + protonup-qt + protontricks + + mpv + qbittorrent + watchmate + nextcloud-client + ventoy + ]; # fuzzy command finder, required by a decent amount of things programs.fzf = { @@ -113,7 +155,27 @@ }; }; - xdg.userDirs.enable = true; + # this is a got damn NEO VIMME HOUSE !! + home.sessionVariables = { + EDITOR = "nvim"; + }; + + # flatpaks + # TODO: unsure if i should even bother using flatpaks in a configuration/distro like this... + # maybe i can fully embrace flatpaks once i've figured out how to remove default packages + #services.flatpak.remotes = lib.mkOptionDefault [{ + # name = "flathub"; + # location = "https://dl.flathub.org/repo/#flathub.flatpakrepo"; + #}]; + # + #services.flatpak.update.auto.enable = true; + #services.flatpak.uninstallUnmanaged = true; + # flatpak user packages + #services.flatpak.packages = [ + #{ appId = "com.brave.Browser"; origin = "flathub"; } + #"com.obsproject.Studio" + #"im.riot.Riot" + #]; # music!! services.mpd = { @@ -126,31 +188,10 @@ ''; }; - # Add stuff for your user as you see fit: - programs.neovim.enable = true; - home.packages = with pkgs; [ - btop - bat - duf - fastfetch - fd - delta - lsd - ripgrep - sd - starship - zoxide + xdg.userDirs.enable = true; - usbutils - jq - ffmpeg_6-full - imagemagick - yt-dlp - - mpv - nextcloud-client - ventoy - ]; + # catppuccin flavour + catppuccin.flavour = "mocha"; # catppuccin's gtk theme gtk = {