change flakes, fix typos in readme
This commit is contained in:
parent
462f0033e6
commit
862a55eb25
24
README.md
24
README.md
@ -14,7 +14,7 @@ Differences:
|
|||||||
import this flake in your 'flake.nix':
|
import this flake in your 'flake.nix':
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
inputs.base16.url = 'github:alukardbf/base16-nix';
|
inputs.base16.url = "github:alukardbf/base16-nix";
|
||||||
```
|
```
|
||||||
|
|
||||||
then, in any home-manager configuration:
|
then, in any home-manager configuration:
|
||||||
@ -22,8 +22,7 @@ then, in any home-manager configuration:
|
|||||||
```nix
|
```nix
|
||||||
home.user.${user} = { config, pkgs, lib }: {
|
home.user.${user} = { config, pkgs, lib }: {
|
||||||
imports = [ base16.hmModule ];
|
imports = [ base16.hmModule ];
|
||||||
|
};
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
@ -48,11 +47,11 @@ home.user.${user} = { config, pkgs, lib }: {
|
|||||||
###############################
|
###############################
|
||||||
|
|
||||||
programs.bash.initExtra = ''
|
programs.bash.initExtra = ''
|
||||||
source ${config.lib.base16.templateFile { name = "shell"; };}
|
source ${config.lib.base16.templateFile { name = "shell"; }}
|
||||||
'';
|
'';
|
||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
theme = "${config.lib.base16.templateFile { name = "rofi"; type = "color"; };}";
|
theme = "${config.lib.base16.templateFile { name = "rofi"; type = "colors"; }}";
|
||||||
};
|
};
|
||||||
|
|
||||||
# 2. Template strings directly into other home-manager configuration
|
# 2. Template strings directly into other home-manager configuration
|
||||||
@ -103,7 +102,7 @@ You can also use local schemes:
|
|||||||
customScheme = {
|
customScheme = {
|
||||||
enable = true;
|
enable = true;
|
||||||
path = ./base16-custom-scheme.yaml;
|
path = ./base16-custom-scheme.yaml;
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -130,13 +129,13 @@ inputs.base16-horizon-scheme = {
|
|||||||
customScheme = {
|
customScheme = {
|
||||||
enable = true;
|
enable = true;
|
||||||
path = "${inputs.base16-horizon-scheme}/horizon-dark.yaml";
|
path = "${inputs.base16-horizon-scheme}/horizon-dark.yaml";
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# The template will be generated from the local scheme
|
# The template will be generated from the local scheme
|
||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
theme = "${config.lib.base16.templateFile { name = "rofi"; };}";
|
theme = "${config.lib.base16.templateFile { name = "rofi"; }}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -146,20 +145,21 @@ inputs.base16-horizon-scheme = {
|
|||||||
|
|
||||||
Changing themes involves switching the theme definition and typing
|
Changing themes involves switching the theme definition and typing
|
||||||
`home-manager switch`. There is no attempt in general to force programs to
|
`home-manager switch`. There is no attempt in general to force programs to
|
||||||
reload, and not all are able to reload their configs, although I have found
|
reload, and not all are able to reload their configs, although occasionally restarting applications has been enough.
|
||||||
that reloading xmonad and occasionally restarting applications has been
|
|
||||||
enough.
|
|
||||||
|
|
||||||
You are unlikely to achieve a complete switch without logging out and logging back
|
You are unlikely to achieve a complete switch without logging out and logging back
|
||||||
in again.
|
in again.
|
||||||
|
|
||||||
|
Also, if you use home-manager as a module in the system configuration, the switch should be done with the command `nixos-rebuild switch`.
|
||||||
|
|
||||||
## Updating Sources
|
## Updating Sources
|
||||||
|
|
||||||
If you're using nix flakes:
|
If you're using nix flakes:
|
||||||
|
|
||||||
- Fork this repository
|
- Fork this repository
|
||||||
- `cd` into repository dir
|
- `cd` into repository dir
|
||||||
- Enter `nix develop` and then run `update-base16`
|
- Enter `nix develop` and then run `update-base16` OR
|
||||||
|
- Enter `nix run .`
|
||||||
- Commit and push new files
|
- Commit and push new files
|
||||||
|
|
||||||
If you're **not** using nix flakes:
|
If you're **not** using nix flakes:
|
||||||
|
16
flake.lock
generated
16
flake.lock
generated
@ -1,5 +1,20 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1631561581,
|
||||||
|
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1623798125,
|
"lastModified": 1623798125,
|
||||||
@ -17,6 +32,7 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
87
flake.nix
87
flake.nix
@ -2,43 +2,60 @@
|
|||||||
description = "Base16-template builder for nix.";
|
description = "Base16-template builder for nix.";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "nixpkgs/release-21.05";
|
inputs.nixpkgs.url = "nixpkgs/release-21.05";
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs }:
|
outputs = { self, nixpkgs, flake-utils }@inputs:
|
||||||
let
|
flake-utils.lib.eachDefaultSystem
|
||||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
(system:
|
||||||
in {
|
with nixpkgs.legacyPackages.${system};
|
||||||
|
{
|
||||||
|
# Home-Manager Module
|
||||||
|
hmModule = ./base16.nix;
|
||||||
|
|
||||||
# Home-Manager Module
|
packages.update-base16 = (let
|
||||||
hmModule = ./base16.nix;
|
mkScript = { name, file, env ? [ ] }:
|
||||||
|
writeTextFile {
|
||||||
|
name = "${name}";
|
||||||
|
executable = true;
|
||||||
|
destination = "/bin/${name}";
|
||||||
|
text = ''
|
||||||
|
for i in ${lib.concatStringsSep " " env}; do
|
||||||
|
export PATH="$i/bin:$PATH"
|
||||||
|
done
|
||||||
|
exec ${bash}/bin/bash ${file} $@
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in mkScript rec {
|
||||||
|
name = "update-base16";
|
||||||
|
env = [ curl nix-prefetch-git gnused jq ];
|
||||||
|
file = writeTextFile {
|
||||||
|
name = "${name}.sh";
|
||||||
|
executable = true;
|
||||||
|
text = ''
|
||||||
|
generate_sources () {
|
||||||
|
out=$1
|
||||||
|
curl "https://raw.githubusercontent.com/chriskempson/base16-$out-source/master/list.yaml"\
|
||||||
|
| sed -nE "s~^([-_[:alnum:]]+): *(.*)~\1 \2~p"\
|
||||||
|
| while read name src; do
|
||||||
|
echo "{\"key\":\"$name\",\"value\":"
|
||||||
|
nix-prefetch-git $src
|
||||||
|
echo "}"
|
||||||
|
done\
|
||||||
|
| jq -s ".|del(.[].value.date)|from_entries"\
|
||||||
|
> $out.json
|
||||||
|
}
|
||||||
|
generate_sources templates &
|
||||||
|
generate_sources schemes &
|
||||||
|
wait
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
# Nix shell definition. Enter with 'nix develop'. Inside, can use
|
defaultPackage = packages.update-base16;
|
||||||
# 'update-base16' to update the sources lists.
|
|
||||||
devShell.x86_64-linux = let
|
|
||||||
update = pkgs.writeShellScriptBin "update-base16" ''
|
|
||||||
# should always be permitted to run to completion
|
|
||||||
|
|
||||||
generate_sources () {
|
|
||||||
out=$1
|
|
||||||
curl "https://raw.githubusercontent.com/chriskempson/base16-$out-source/master/list.yaml"\
|
|
||||||
| sed -nE "s~^([-_[:alnum:]]+): *(.*)~\1 \2~p"\
|
|
||||||
| while read name src; do
|
|
||||||
echo "{\"key\":\"$name\",\"value\":"
|
|
||||||
nix-prefetch-git $src
|
|
||||||
echo "}"
|
|
||||||
done\
|
|
||||||
| jq -s ".|del(.[].value.date)|from_entries"\
|
|
||||||
> $out.json
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_sources templates &
|
|
||||||
generate_sources schemes &
|
|
||||||
wait
|
|
||||||
'';
|
|
||||||
in pkgs.mkShell {
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
curl nix-prefetch-git gnused jq update
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
devShell = mkShell {
|
||||||
|
buildInputs = [ packages.update-base16 ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user