mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-03-13 18:19:00 +00:00
wrapperPackages/dotfiles-wrapped: init
Not all of it is working as intended but we'll fix at a later time.
This commit is contained in:
parent
59afe5f131
commit
af0f25b7b0
@ -7,6 +7,11 @@
|
||||
systems = [ "x86_64-linux" ];
|
||||
nixpkgs.branch = "nixos-unstable";
|
||||
};
|
||||
|
||||
dotfiles-wrapped = {
|
||||
systems = [ "x86_64-linux" ];
|
||||
nixpkgs.branch = "nixos-unstable";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
70
configs/wrapper-manager/dotfiles-wrapped/default.nix
Normal file
70
configs/wrapper-manager/dotfiles-wrapped/default.nix
Normal file
@ -0,0 +1,70 @@
|
||||
# All of the programs with my outside dotfiles from
|
||||
# https://github.com/foo-dogsquared/dotfiles. Pretty nifty for me to have,
|
||||
# yeah? This should work on both NixOS and non-NixOS system considering that
|
||||
# parts from the config are conditionally setting up NixGL wrapping.
|
||||
let
|
||||
sources = import ./npins;
|
||||
in
|
||||
{ lib, pkgs, wrapperManagerLib, ... }@moduleArgs:
|
||||
|
||||
let
|
||||
inherit (sources) dotfiles nixgl;
|
||||
|
||||
getDotfiles = path: "${dotfiles}/${path}";
|
||||
isInNonNixOS = !(moduleArgs ? nixosConfig);
|
||||
|
||||
wrapNixGL = arg0:
|
||||
if isInNonNixOS then {
|
||||
nixgl.enable = true;
|
||||
nixgl.wraparound.executable = arg0;
|
||||
} else {
|
||||
inherit arg0;
|
||||
};
|
||||
in
|
||||
{
|
||||
nixgl.src = nixgl;
|
||||
|
||||
wrappers.wezterm = lib.mkMerge [
|
||||
{
|
||||
env.WEZTERM_CONFIG_FILE.value = getDotfiles "wezterm/wezterm.lua";
|
||||
}
|
||||
|
||||
(wrapNixGL (lib.getExe' pkgs.wezterm "wezterm"))
|
||||
];
|
||||
|
||||
wrappers.kitty = lib.mkMerge [
|
||||
{
|
||||
env.KITTY_CONFIG_DIRECTORY.value = getDotfiles "kitty";
|
||||
}
|
||||
|
||||
(wrapNixGL (lib.getExe' pkgs.kitty "kitty"))
|
||||
];
|
||||
|
||||
wrappers.nvim = {
|
||||
env.VIM.value = getDotfiles "nvim";
|
||||
arg0 = lib.getExe' pkgs.neovim "nvim";
|
||||
};
|
||||
|
||||
# Trying to create a portable Doom Emacs.
|
||||
wrappers.emacs = lib.mkMerge [
|
||||
{
|
||||
env.EMACSDIR.value = sources.doom-emacs;
|
||||
env.DOOMDIR.value = getDotfiles "emacs";
|
||||
env.DOOMPROFILELOADFILE.value = "$XDG_CACHE_HOME/doom/profiles.el";
|
||||
|
||||
# TODO: This will be removed in Doom Emacs 3.0 as far as I can tell so we'll
|
||||
# remove it once that happens.
|
||||
env.DOOMLOCALDIR.value = "$XDG_CONFIG_HOME/emacs/";
|
||||
|
||||
pathAdd = wrapperManagerLib.getBin [
|
||||
sources.doom-emacs
|
||||
];
|
||||
}
|
||||
|
||||
(wrapNixGL (lib.getExe' pkgs.emacs "emacs"))
|
||||
];
|
||||
|
||||
build.extraSetup = ''
|
||||
install -Dm0755 ${getDotfiles "bin"}/* -t $out/bin
|
||||
'';
|
||||
}
|
80
configs/wrapper-manager/dotfiles-wrapped/npins/default.nix
Normal file
80
configs/wrapper-manager/dotfiles-wrapped/npins/default.nix
Normal file
@ -0,0 +1,80 @@
|
||||
# Generated by npins. Do not modify; will be overwritten regularly
|
||||
let
|
||||
data = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
version = data.version;
|
||||
|
||||
mkSource =
|
||||
spec:
|
||||
assert spec ? type;
|
||||
let
|
||||
path =
|
||||
if spec.type == "Git" then
|
||||
mkGitSource spec
|
||||
else if spec.type == "GitRelease" then
|
||||
mkGitSource spec
|
||||
else if spec.type == "PyPi" then
|
||||
mkPyPiSource spec
|
||||
else if spec.type == "Channel" then
|
||||
mkChannelSource spec
|
||||
else
|
||||
builtins.throw "Unknown source type ${spec.type}";
|
||||
in
|
||||
spec // { outPath = path; };
|
||||
|
||||
mkGitSource =
|
||||
{
|
||||
repository,
|
||||
revision,
|
||||
url ? null,
|
||||
hash,
|
||||
branch ? null,
|
||||
...
|
||||
}:
|
||||
assert repository ? type;
|
||||
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
|
||||
# In the latter case, there we will always be an url to the tarball
|
||||
if url != null then
|
||||
(builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash; # FIXME: check nix version & use SRI hashes
|
||||
})
|
||||
else
|
||||
assert repository.type == "Git";
|
||||
let
|
||||
urlToName =
|
||||
url: rev:
|
||||
let
|
||||
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
|
||||
|
||||
short = builtins.substring 0 7 rev;
|
||||
|
||||
appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else "";
|
||||
in
|
||||
"${if matched == null then "source" else builtins.head matched}${appendShort}";
|
||||
name = urlToName repository.url revision;
|
||||
in
|
||||
builtins.fetchGit {
|
||||
url = repository.url;
|
||||
rev = revision;
|
||||
inherit name;
|
||||
# hash = hash;
|
||||
};
|
||||
|
||||
mkPyPiSource =
|
||||
{ url, hash, ... }:
|
||||
builtins.fetchurl {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
mkChannelSource =
|
||||
{ url, hash, ... }:
|
||||
builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
in
|
||||
if version == 3 then
|
||||
builtins.mapAttrs (_: mkSource) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
41
configs/wrapper-manager/dotfiles-wrapped/npins/sources.json
Normal file
41
configs/wrapper-manager/dotfiles-wrapped/npins/sources.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"pins": {
|
||||
"doom-emacs": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "doomemacs",
|
||||
"repo": "doomemacs"
|
||||
},
|
||||
"branch": "master",
|
||||
"revision": "0f30e1eca5f7cb9220d2d1caf4fef7214a86c339",
|
||||
"url": "https://github.com/doomemacs/doomemacs/archive/0f30e1eca5f7cb9220d2d1caf4fef7214a86c339.tar.gz",
|
||||
"hash": "004xf0681rizdavl0krpx015h9zyb12ma4gq11nazcy8547qg3kl"
|
||||
},
|
||||
"dotfiles": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "foo-dogsquared",
|
||||
"repo": "dotfiles"
|
||||
},
|
||||
"branch": "master",
|
||||
"revision": "c0c64c9f9dae40c7041933851894e14601b56ba7",
|
||||
"url": "https://github.com/foo-dogsquared/dotfiles/archive/c0c64c9f9dae40c7041933851894e14601b56ba7.tar.gz",
|
||||
"hash": "1sm00fxajqhrccbxl5647na4fw9cha6w8jvarg5p4kvs3rrwh5p2"
|
||||
},
|
||||
"nixgl": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixGL"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a",
|
||||
"url": "https://github.com/nix-community/nixGL/archive/310f8e49a149e4c9ea52f1adf70cdc768ec53f8a.tar.gz",
|
||||
"hash": "1crnbv3mdx83xjwl2j63rwwl9qfgi2f1lr53zzjlby5lh50xjz4n"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
Loading…
Reference in New Issue
Block a user