more structural improvements

This commit is contained in:
Thilo Billerbeck 2023-05-03 02:27:17 +02:00
parent 3aad02ea56
commit 325a2c54de
5 changed files with 93 additions and 86 deletions

View file

@ -1,67 +1,32 @@
{ config, pkgs, lib, ... }:
let
chromeArgs = lib.strings.concatStringsSep " " [
"--force-dark-mode"
"--enable-features=WebUIDarkMode"
"--enable-smooth-scrolling"
"--ozone-platform-hint=auto"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
];
nixgl = import <nixgl> { };
nixGLWrap = pkg:
pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
mkdir $out/bin
for bin in ${pkg}/bin/*; do
wrapped_bin=$out/bin/$(basename $bin)
echo -e "#!/bin/bash\nexec ${lib.getExe nixgl.auto.nixGLDefault} $bin \$@" > $wrapped_bin
chmod +x $wrapped_bin
done
'';
in {
{
nixpkgs.config.allowUnfree = true;
targets.genericLinux.enable = true;
news.display = "silent";
imports = map (n: "${./programs}/${n}")
(builtins.attrNames (builtins.readDir ./programs));
imports = [
./programs/alacritty.nix
./programs/bat.nix
./programs/beets.nix
./programs/command-not-found.nix
./programs/direnv.nix
./programs/fzf.nix
./programs/git.nix
./programs/htop.nix
./programs/neovim.nix
./programs/starship.nix
./programs/topgrade.nix
./programs/vscode.nix
./programs/yt-dlp.nix
./programs/zsh.nix
./packages.nix
];
home = {
username = "thilo";
homeDirectory = "/home/thilo";
stateVersion = "22.11";
packages = [
pkgs.up
pkgs.rbenv
pkgs.cargo-update
pkgs.htop
pkgs.rustup
pkgs.nixfmt
pkgs.nodejs
pkgs.bun
pkgs.deno
pkgs.devbox
pkgs.tldr
pkgs.flutter
(import (fetchTarball
"https://github.com/cachix/devenv/archive/v0.6.2.tar.gz")).default
(pkgs.nerdfonts.override {
fonts = [ "JetBrainsMono" "FiraCode" "FiraMono" ];
})
(nixGLWrap (pkgs.vivaldi.override {
proprietaryCodecs = true;
enableWidevine = true;
commandLineArgs = chromeArgs;
}))
(nixGLWrap
(pkgs.google-chrome.override { commandLineArgs = chromeArgs; }))
(pkgs.writeShellScriptBin "ssh-fix-permissions" (builtins.readFile ./scripts/ssh-fix-permissions.sh))
(pkgs.writeShellScriptBin "yt-dlp-audio" (builtins.readFile ./scripts/yt-dlp-audio.sh))
];
file = {
".config/nano/nanorc".text = ''
set linenumbers

55
packages.nix Normal file
View file

@ -0,0 +1,55 @@
{ config, pkgs, lib, ... }:
let
chromeArgs = lib.strings.concatStringsSep " " [
"--force-dark-mode"
"--enable-features=WebUIDarkMode"
"--enable-smooth-scrolling"
"--ozone-platform-hint=auto"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
];
nixGLWrap = import ./utils/nixGLWrap.nix { inherit pkgs lib; };
in {
home.packages = with pkgs;
[
up
rbenv
cargo-update
htop
rustup
nixfmt
nodejs
bun
deno
devbox
tldr
flutter
nurl
hcloud
tea
] ++ [
(import (fetchTarball
"https://github.com/cachix/devenv/archive/v0.6.2.tar.gz")).default
(pkgs.nerdfonts.override {
fonts = [ "JetBrainsMono" "FiraCode" "FiraMono" ];
})
(nixGLWrap (pkgs.vivaldi.override {
proprietaryCodecs = true;
enableWidevine = true;
commandLineArgs = chromeArgs;
}))
(nixGLWrap
(pkgs.google-chrome.override { commandLineArgs = chromeArgs; }))
(pkgs.writeShellScriptBin "ssh-fix-permissions"
(builtins.readFile ./scripts/ssh-fix-permissions.sh))
(pkgs.writeShellScriptBin "yt-dlp-audio"
(builtins.readFile ./scripts/yt-dlp-audio.sh))
(pkgs.writeShellScriptBin "craft" ((pkgs.fetchFromGitHub {
owner = "codemonauts";
repo = "docker-craft-cms-dev-env";
rev = "5053d61654bc720fd61e011642e925a99d81baa0";
hash = "sha256-VNL/cyECDx0FSn2xMHMQDbJ3d0y7SEKPZ2EzotQy/PA=";
}) + /bin/craft))
];
}

View file

@ -1,21 +1,6 @@
{ config, pkgs, lib, ... }:
let
nixgl = import <nixgl> { };
nixGLWrap = pkg:
pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
mkdir $out/bin
for bin in ${pkg}/bin/*; do
wrapped_bin=$out/bin/$(basename $bin)
echo -e "#!/bin/bash\nexec ${
lib.getExe nixgl.auto.nixGLDefault
} $bin \$@" > $wrapped_bin
chmod +x $wrapped_bin
done
'';
let nixGLWrap = import ./../utils/nixGLWrap.nix { inherit pkgs lib; };
in {
programs.alacritty = {
enable = true;

View file

@ -1,20 +1,5 @@
{ config, pkgs, lib, ... }:
let
nixgl = import <nixgl> { };
nixGLWrap = pkg:
pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
mkdir $out/bin
for bin in ${pkg}/bin/*; do
wrapped_bin=$out/bin/$(basename $bin)
echo -e "#!/bin/bash\nexec ${
lib.getExe nixgl.auto.nixGLDefault
} $bin \$@" > $wrapped_bin
chmod +x $wrapped_bin
done
'';
let nixGLWrap = import ./../utils/nixGLWrap.nix { inherit pkgs lib; };
in {
programs = {
vscode = {

17
utils/nixGLWrap.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, lib, ... }:
let nixgl = import <nixgl> { };
in pkg:
pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
mkdir $out/bin
for bin in ${pkg}/bin/*; do
wrapped_bin=$out/bin/$(basename $bin)
echo -e "#!/bin/bash\nexec ${
lib.getExe nixgl.auto.nixGLDefault
} $bin \$@" > $wrapped_bin
chmod +x $wrapped_bin
done
''