Skip to content

Commit

Permalink
Merge pull request #2 from ocfox/home-haumea
Browse files Browse the repository at this point in the history
  • Loading branch information
ocfox authored Apr 24, 2023
2 parents da8b087 + 9b426cd commit 95507ee
Show file tree
Hide file tree
Showing 34 changed files with 239 additions and 213 deletions.
25 changes: 17 additions & 8 deletions darwin/default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
{ username, nixpkgs, darwin, inputs, ... }:
{ username
, darwin
, inputs
, home
, ...
}:
let
silverfox = { pkgs, username, ... }@args: inputs.haumea.lib.load {
src = ./silverfox;
inputs = args // {
inherit inputs;
};
transformer = inputs.haumea.lib.transformers.liftDefault;
};
in
darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
./configuration.nix
silverfox
inputs.home-manager.darwinModules.home-manager
{
nixpkgs.config.allowUnfree = true;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${username} = import ./home.nix;
}
];
specialArgs = { inherit inputs username home; };
}
35 changes: 0 additions & 35 deletions darwin/home.nix

This file was deleted.

46 changes: 13 additions & 33 deletions darwin/configuration.nix → darwin/silverfox/default.nix
Original file line number Diff line number Diff line change
@@ -1,43 +1,26 @@
{ pkgs, lib, ... }:
{ pkgs, ... }:
{
nix.settings.trusted-users = [
"@admin"
];
nix.configureBuildUsers = true;

users.users.ocfox.shell = pkgs.fish;
nix.configureBuildUsers = true;

nix.extraOptions = ''
auto-optimise-store = true
experimental-features = nix-command flakes
'' + lib.optionalString (pkgs.system == "aarch64-darwin") ''
extra-platforms = x86_64-darwin aarch64-darwin
'';

programs.fish.enable = true;
nixpkgs.config.allowUnfree = true;

homebrew = {
enable = true;

taps = [
"koekeishiya/formulae"
];

brews = [
"yabai"
"skhd"
];
};
programs.fish.enable = true;

services.nix-daemon.enable = true;

environment.systemPackages = with pkgs; [
kitty
];

environment.shells = with pkgs; [ fish ];
environment.shells = [ pkgs.fish ];

programs.nix-index.enable = true;
users.users.ocfox.shell = pkgs.fish;

fonts.fontDir.enable = true;

Expand All @@ -46,17 +29,14 @@
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];

nixpkgs.overlays = [
(self: super: {
neovim = super.neovim.override {
viAlias = true;
vimAlias = true;
};
})
environment.systemPackages = with pkgs; [
coreutils
git
curl
wget
ripgrep
lazygit
];

system.keyboard.enableKeyMapping = true;
system.keyboard.remapCapsLockToEscape = true;

security.pam.enableSudoTouchIdAuth = true;
}
15 changes: 15 additions & 0 deletions darwin/silverfox/home-manager.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ username
, home
, inputs
}:
{
useGlobalPkgs = true;
useUserPackages = true;
users.${username} = {
imports = [
home.default
home.darwin
];
};
extraSpecialArgs = { inherit username; };
}
32 changes: 24 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,37 @@
} @ inputs:
let
username = "ocfox";
home-manager = { pkgs, ... }@args: haumea.lib.load {
src = ./home;
inputs = args // {
inherit inputs;
home = {
default = { pkgs, ... }@args: haumea.lib.load {
src = ./home;
inputs = args // {
inherit inputs;
};
transformer = haumea.lib.transformers.liftDefault;
};
desktop = { pkgs, ... }@args: haumea.lib.load {
src = ./home-desktop;
inputs = args // {
inherit inputs;
};
transformer = haumea.lib.transformers.liftDefault;
};
darwin = { pkgs, ... }@args: haumea.lib.load {
src = ./home-darwin;
inputs = args // {
inherit inputs;
};
transformer = haumea.lib.transformers.liftDefault;
};
transformer = haumea.lib.transformers.liftDefault;
};
in
{
nixosConfigurations = import ./hosts {
inherit self nixpkgs inputs username home-manager;
inherit self nixpkgs inputs username home;
};

darwinConfigurations.sliverfox = import ./hosts/sliverfox {
inherit self nixpkgs darwin inputs username;
darwinConfigurations.silverfox = import ./darwin {
inherit self nixpkgs darwin inputs username home;
};

ferrucyon = import ./iso {
Expand Down
3 changes: 3 additions & 0 deletions home-darwin/home/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
stateVersion = "23.05";
}
5 changes: 5 additions & 0 deletions home-darwin/home/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ pkgs }:
with pkgs;
[
hello
]
7 changes: 7 additions & 0 deletions home-darwin/programs/fish.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
functions = {
rebuild = ''
darwin-rebuild switch --use-remote-sudo --flake $HOME/nixos#silverfox
'';
};
}
1 change: 1 addition & 0 deletions home-darwin/programs/git.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ }
3 changes: 3 additions & 0 deletions home-darwin/programs/kitty.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
font.size = 20;
}
File renamed without changes.
12 changes: 12 additions & 0 deletions home-desktop/home/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ pkgs }:
{
pointerCursor = {
size = 24;
gtk.enable = true;
x11.enable = true;
package = pkgs.apple-cursor;
name = "macOS-Monterey";
};

stateVersion = "23.05";
}
98 changes: 98 additions & 0 deletions home-desktop/home/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{ lib
, pkgs
}:
with pkgs;
[
bitwarden
wl-clipboard
swayidle
showmethekey
element-desktop
qbittorrent
tdesktop
firefox-wayland

ncspot
sptlrx
playerctl
cava
vlc
wf-recorder

nur.repos.linyinfeng.wemeet
nur.repos.linyinfeng.icalingua-plus-plus
nur.repos.xddxdd.qq

texlive.combined.scheme-medium
(
pkgs.writeShellScriptBin "record-status" ''
#!/usr/bin/env bash
pid=`pgrep wf-recorder`
status=$?
if [ $status != 0 ]
then
echo '';
else
echo '';
fi;
''
)

(
pkgs.writeShellScriptBin "screen-recorder-toggle" ''
#!/usr/bin/env bash
pid=`${pkgs.procps}/bin/pgrep wf-recorder`
status=$?
if [ $status != 0 ]
then
${lib.getExe pkgs.wf-recorder} -g "$(${lib.getExe pkgs.slurp})" -f $HOME/Videos/record/$(date +'recording_%Y-%m-%d-%H%M%S.mp4');
else
${pkgs.procps}/bin/pkill --signal SIGINT wf-recorder
fi;
''
)

(
pkgs.writeShellScriptBin "power-menu" ''
#!/usr/bin/env bash
options="shutdown\nreboot\nsuspend\nexit sway"
selection="$(${pkgs.coreutils}/bin/echo -e $options | \
${lib.getExe pkgs.bemenu} -i -l 4 -c -W 0.3)"
case $selection in
shutdown) ${pkgs.systemd}/bin/systemctl poweroff
exit 0
;;
reboot) ${pkgs.systemd}/bin/systemctl reboot
exit 0
;;
suspend) ${pkgs.systemd}/bin/systemctl suspend
exit 0
;;
esac''
)
(
writeShellScriptBin "mac-shot" ''
file=/tmp/xxx.png
${lib.getExe sway-contrib.grimshot} --notify save area /tmp/src.png >> /dev/null 2>&1
${imagemagick}/bin/convert /tmp/src.png \
\( +clone -alpha extract \
-draw 'fill black polygon 0,0 0,8 8,0 fill white circle 8,8 8,0' \
\( +clone -flip \) -compose Multiply -composite \
\( +clone -flop \) -compose Multiply -composite \
\) -alpha off -compose CopyOpacity -composite /tmp/output.png
${imagemagick}/bin/convert /tmp/output.png -bordercolor none -border 20 \
\( +clone -background black -shadow 80x8+15+15 \) \
+swap -background transparent -layers merge +repage $file
${wl-clipboard}/bin/wl-copy -t image/png < $file
${libnotify}/bin/notify-send "macshot copied"
rm /tmp/src.png /tmp/output.png
''
)
]
11 changes: 11 additions & 0 deletions home-desktop/programs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ pkgs }:
{
chromium = {
enable = true;
commandLineArgs = [ "--enable-features=UseOzonePlatform" "-ozone-platform=wayland" "--gtk-version=4" ];
};
obs-studio = {
enable = true;
plugins = with pkgs; [ obs-studio-plugins.wlrobs ];
};
}
13 changes: 13 additions & 0 deletions home-desktop/programs/fish.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
interactiveShellInit = ''
if test (id --user $USER) = 1000 && test (tty) = "/dev/tty1"
exec sway
end
'';

functions = {
rebuild = ''
nixos-rebuild switch --use-remote-sudo --flake $HOME/nixos#whitefox
'';
};
}
6 changes: 6 additions & 0 deletions home-desktop/programs/git.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
signing = {
signByDefault = true;
key = "939EF8A5CED87F505BB5B2D024BC27385F70234F";
};
}
3 changes: 3 additions & 0 deletions home-desktop/programs/kitty.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
font.size = 10;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions home/home/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
{ pkgs }:
{
pointerCursor = {
size = 24;
gtk.enable = true;
x11.enable = true;
package = pkgs.apple-cursor;
name = "macOS-Monterey";
};

stateVersion = "23.05";
}
Loading

0 comments on commit 95507ee

Please sign in to comment.