From d8e53f1f78d2dd3fab13a8306c4edcccf4b0cdb9 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Thu, 1 Feb 2024 12:28:31 +0100 Subject: [PATCH] use snowfall --- flake.lock | 104 ++++++++++++++++-- flake.nix | 60 ++++------ .../x86_64-linux/julian@aspi/default.nix} | 20 +++- .../modules/home/alacritty/alacritty.toml | 8 ++ .../alacritty/default.nix} | 5 +- .../direnv.nix => home/direnv/default.nix} | 0 .../modules/{i3.nix => home/i3/default.nix} | 0 .../{neovim.nix => home/neovim/default.nix} | 0 .../{rofi.nix => home/rofi/default.nix} | 0 .../topgrade/default.nix} | 0 .../modules/{shell => home}/zsh/default.nix | 4 +- .../{shell => home}/zsh/dir-navigation.zsh | 0 .../modules/{shell => home}/zsh/functions.zsh | 0 .../{shell => home}/zsh/key-bindings.zsh | 0 .../{shell => home}/zsh/last-working-dir.zsh | 0 home-manager/modules/home/zsh/starship.toml | 14 +++ 16 files changed, 160 insertions(+), 55 deletions(-) rename home-manager/{home.nix => homes/x86_64-linux/julian@aspi/default.nix} (72%) create mode 100644 home-manager/modules/home/alacritty/alacritty.toml rename home-manager/modules/{alacritty.nix => home/alacritty/default.nix} (79%) rename home-manager/modules/{shell/direnv.nix => home/direnv/default.nix} (100%) rename home-manager/modules/{i3.nix => home/i3/default.nix} (100%) rename home-manager/modules/{neovim.nix => home/neovim/default.nix} (100%) rename home-manager/modules/{rofi.nix => home/rofi/default.nix} (100%) rename home-manager/modules/{topgrade.nix => home/topgrade/default.nix} (100%) rename home-manager/modules/{shell => home}/zsh/default.nix (91%) rename home-manager/modules/{shell => home}/zsh/dir-navigation.zsh (100%) rename home-manager/modules/{shell => home}/zsh/functions.zsh (100%) rename home-manager/modules/{shell => home}/zsh/key-bindings.zsh (100%) rename home-manager/modules/{shell => home}/zsh/last-working-dir.zsh (100%) create mode 100644 home-manager/modules/home/zsh/starship.toml diff --git a/flake.lock b/flake.lock index b224a13..2c344d6 100644 --- a/flake.lock +++ b/flake.lock @@ -16,10 +16,62 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils-plus": { + "inputs": { + "flake-utils": "flake-utils" + }, + "locked": { + "lastModified": 1696331477, + "narHash": "sha256-YkbRa/1wQWdWkVJ01JvV+75KIdM37UErqKgTf0L54Fk=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "bfc53579db89de750b25b0c5e7af299e0c06d7d3", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ - "nixpkgs-stable" + "nixpkgs" ] }, "locked": { @@ -37,13 +89,13 @@ "type": "github" } }, - "nixpkgs-stable": { + "nixpkgs": { "locked": { - "lastModified": 1704874635, - "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", + "lastModified": 1706515015, + "narHash": "sha256-eFfY5A7wlYy3jD/75lx6IJRueg4noE+jowl0a8lIlVo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", + "rev": "f4a8d6d5324c327dcc2d863eb7f3cc06ad630df4", "type": "github" }, "original": { @@ -73,8 +125,46 @@ "inputs": { "alacritty-theme": "alacritty-theme", "home-manager": "home-manager", - "nixpkgs-stable": "nixpkgs-stable", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "snowfall-lib": "snowfall-lib" + } + }, + "snowfall-lib": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils-plus": "flake-utils-plus", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696432959, + "narHash": "sha256-oJQZv2MYyJaVyVJY5IeevzqpGvMGKu5pZcCCJvb+xjc=", + "owner": "snowfallorg", + "repo": "lib", + "rev": "92803a029b5314d4436a8d9311d8707b71d9f0b6", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "lib", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 96c8f7b..1e1dccd 100644 --- a/flake.nix +++ b/flake.nix @@ -2,12 +2,17 @@ description = "Home Manager configuration of julian"; inputs = { - nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager/release-23.11"; - inputs.nixpkgs.follows = "nixpkgs-stable"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + snowfall-lib = { + url = "github:snowfallorg/lib"; + inputs.nixpkgs.follows = "nixpkgs"; }; alacritty-theme = { @@ -16,45 +21,22 @@ }; }; - outputs = { nixpkgs-stable, nixpkgs-unstable, home-manager, ... }@inputs: - let - system = "x86_64-linux"; + outputs = inputs: + inputs.snowfall-lib.mkFlake { + inherit inputs; + # Must always be ./. + src = ./.; - unstable-overlay = final: prev: { - unstable = import nixpkgs-unstable { - inherit system; - config.allowUnfree = true; + snowfall = { + # The root of the snowfall config + root = ./home-manager; + # lib namespace + namepace = "frajul"; + + meta = { + # name = "my home configs name"; + # title = "my home configs title"; }; }; - - pkgs = import nixpkgs-stable { - inherit system; - config.allowUnfree = true; - overlays = [ unstable-overlay ]; - }; - - # Does not follow symlinks - listNixFilesRec = dir: - pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (name: value: - let path = "${toString dir}/${name}"; - in if value == "directory" && builtins.pathExists path then - listNixFilesRec path - else if value == "regular" && pkgs.lib.hasSuffix ".nix" name then - path - else - [ ]) (builtins.readDir dir)); - in { - homeConfigurations."julian" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ ./home-manager/home.nix ] - ++ listNixFilesRec ./home-manager/modules; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = { inherit inputs; }; - }; }; } diff --git a/home-manager/home.nix b/home-manager/homes/x86_64-linux/julian@aspi/default.nix similarity index 72% rename from home-manager/home.nix rename to home-manager/homes/x86_64-linux/julian@aspi/default.nix index adb3e1a..d19fe49 100644 --- a/home-manager/home.nix +++ b/home-manager/homes/x86_64-linux/julian@aspi/default.nix @@ -1,6 +1,22 @@ -{ config, pkgs, inputs, ... }: - { +# Snowfall Lib provides a customized `lib` instance with access to your flake's library +# as well as the libraries available from your flake's inputs. +lib, +# An instance of `pkgs` with your overlays and packages applied is also available. +pkgs, +# You also have access to your flake's inputs. +inputs, + +# Additional metadata is provided by Snowfall Lib. +home, # The home architecture for this host (eg. `x86_64-linux`). +target, # The Snowfall Lib target for this home (eg. `x86_64-home`). +format, # A normalized name for the home target (eg. `home`). +virtual +, # A boolean to determine whether this home is a virtual target using nixos-generators. +host, # The host name for this home. + +# All other arguments come from the home home. +config, ... }: { home.username = "julian"; home.homeDirectory = "/home/julian"; diff --git a/home-manager/modules/home/alacritty/alacritty.toml b/home-manager/modules/home/alacritty/alacritty.toml new file mode 100644 index 0000000..42fdc41 --- /dev/null +++ b/home-manager/modules/home/alacritty/alacritty.toml @@ -0,0 +1,8 @@ +import = [ + "~/.config/alacritty/theme/themes/smoooooth.toml" +] + +[[keyboard.bindings]] +chars = "fzf-z \r" +key = "Z" +mods = "Control" diff --git a/home-manager/modules/alacritty.nix b/home-manager/modules/home/alacritty/default.nix similarity index 79% rename from home-manager/modules/alacritty.nix rename to home-manager/modules/home/alacritty/default.nix index 4cc80f9..c135472 100644 --- a/home-manager/modules/alacritty.nix +++ b/home-manager/modules/home/alacritty/default.nix @@ -12,10 +12,7 @@ in { home.file = { ".config/alacritty/theme".source = "${inputs.alacritty-theme}"; - ".config/alacritty" = { - source = ../../alacritty; - recursive = true; - }; + ".config/alacritty/alacritty.toml".source = ./alacritty.toml; }; }; } diff --git a/home-manager/modules/shell/direnv.nix b/home-manager/modules/home/direnv/default.nix similarity index 100% rename from home-manager/modules/shell/direnv.nix rename to home-manager/modules/home/direnv/default.nix diff --git a/home-manager/modules/i3.nix b/home-manager/modules/home/i3/default.nix similarity index 100% rename from home-manager/modules/i3.nix rename to home-manager/modules/home/i3/default.nix diff --git a/home-manager/modules/neovim.nix b/home-manager/modules/home/neovim/default.nix similarity index 100% rename from home-manager/modules/neovim.nix rename to home-manager/modules/home/neovim/default.nix diff --git a/home-manager/modules/rofi.nix b/home-manager/modules/home/rofi/default.nix similarity index 100% rename from home-manager/modules/rofi.nix rename to home-manager/modules/home/rofi/default.nix diff --git a/home-manager/modules/topgrade.nix b/home-manager/modules/home/topgrade/default.nix similarity index 100% rename from home-manager/modules/topgrade.nix rename to home-manager/modules/home/topgrade/default.nix diff --git a/home-manager/modules/shell/zsh/default.nix b/home-manager/modules/home/zsh/default.nix similarity index 91% rename from home-manager/modules/shell/zsh/default.nix rename to home-manager/modules/home/zsh/default.nix index 6bbf80e..5446b80 100644 --- a/home-manager/modules/shell/zsh/default.nix +++ b/home-manager/modules/home/zsh/default.nix @@ -8,9 +8,7 @@ in { config = mkIf cfg.enable { - home.file = { - ".config/starship.toml".source = ../../../../starship/starship.toml; - }; + home.file = { ".config/starship.toml".source = ./starship.toml; }; home.packages = with pkgs; [ starship ]; diff --git a/home-manager/modules/shell/zsh/dir-navigation.zsh b/home-manager/modules/home/zsh/dir-navigation.zsh similarity index 100% rename from home-manager/modules/shell/zsh/dir-navigation.zsh rename to home-manager/modules/home/zsh/dir-navigation.zsh diff --git a/home-manager/modules/shell/zsh/functions.zsh b/home-manager/modules/home/zsh/functions.zsh similarity index 100% rename from home-manager/modules/shell/zsh/functions.zsh rename to home-manager/modules/home/zsh/functions.zsh diff --git a/home-manager/modules/shell/zsh/key-bindings.zsh b/home-manager/modules/home/zsh/key-bindings.zsh similarity index 100% rename from home-manager/modules/shell/zsh/key-bindings.zsh rename to home-manager/modules/home/zsh/key-bindings.zsh diff --git a/home-manager/modules/shell/zsh/last-working-dir.zsh b/home-manager/modules/home/zsh/last-working-dir.zsh similarity index 100% rename from home-manager/modules/shell/zsh/last-working-dir.zsh rename to home-manager/modules/home/zsh/last-working-dir.zsh diff --git a/home-manager/modules/home/zsh/starship.toml b/home-manager/modules/home/zsh/starship.toml new file mode 100644 index 0000000..8679ea9 --- /dev/null +++ b/home-manager/modules/home/zsh/starship.toml @@ -0,0 +1,14 @@ +# newline between shell prompts +add_newline = false +#format = "$all$directory$character" + +[line_break] +disabled = true + +[directory] +fish_style_pwd_dir_length = 1 + +[status] +map_symbol = true +format = '[$symbol$status $common_meaning$signal_name$maybe_int]($style) ' +disabled = false