-
Notifications
You must be signed in to change notification settings - Fork 4
Nix support #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
AamodJ
wants to merge
9
commits into
BarbUk:master
Choose a base branch
from
AamodJ:nix-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Nix support #41
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3bd39f8
Adding basic flake
AamodJ a37591c
Adding home manager module config options
AamodJ 8e328c8
Updating flake.lock
AamodJ b093a7a
Updating pre-commit config to use system language and adding direnv t…
AamodJ 52a6c2e
Add gitignore for direnv
AamodJ f05b99c
Update README
AamodJ 5b2dbc3
Update README
AamodJ e9b16ad
Move nix rofi integration unsupported message to examples
AamodJ 1a74fe1
Changing options to enableWayland and enableX11 for better clarity
AamodJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # shellcheck shell=bash | ||
|
|
||
| # If .env missing; restore from .env.sample and validate | ||
| # See https://github.com/direnv/direnv/wiki/.envrc-Boilerplate | ||
| if [[ -f .env.sample ]]; then | ||
| if ! command -v createnv >/dev/null; then | ||
| echo 'WARN|createnv missing; https://github.com/cuducos/createnv?tab=readme-ov-file#install' | ||
| elif [[ ! -f .env ]]; then | ||
| createnv --use-default --overwrite || | ||
| echo 'ERROR|https://github.com/cuducos/createnv?tab=readme-ov-file#format-of-sample-files' | ||
| if command dotenv-linter --version >&/dev/null; then | ||
| dotenv-linter .env || echo 'ERROR|https://dotenv-linter.github.io' | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| dotenv_if_exists || direnv status # https://direnv.net/man/direnv-stdlib.1.html | ||
|
|
||
| use_nix | ||
|
|
||
| # Ensure pre-commit hooks are installed when working on the project | ||
| prek install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .direnv/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| { | ||
| description = "Snippy Flake"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
| }; | ||
|
|
||
| outputs = | ||
| { self, nixpkgs }: | ||
| let | ||
| system = "x86_64-linux"; | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
|
|
||
| baseDeps = with pkgs; [ | ||
| rofi | ||
| fzf | ||
| jq | ||
| gettext | ||
| perl | ||
| ]; | ||
|
|
||
| buildPackage = | ||
| { x11, wayland }: | ||
| let | ||
| deps = | ||
| baseDeps | ||
| ++ ( | ||
| with pkgs; | ||
| lib.optionals wayland [ | ||
| wtype | ||
| wl-clipboard | ||
| ] | ||
| ) | ||
| ++ ( | ||
| with pkgs; | ||
| lib.optionals x11 [ | ||
| xdotool | ||
| xclip | ||
| xsel | ||
| ] | ||
| ); | ||
| in | ||
| pkgs.stdenv.mkDerivation { | ||
| pname = "snippy"; | ||
| version = "git"; | ||
|
|
||
| nativeBuildInputs = [ pkgs.makeWrapper ]; | ||
|
|
||
| src = ./.; | ||
|
|
||
| installPhase = '' | ||
| mkdir -p $out/bin | ||
| cp snippy $out/bin | ||
|
|
||
| wrapProgram $out/bin/snippy\ | ||
| --prefix PATH : ${pkgs.lib.makeBinPath deps} | ||
| ''; | ||
| }; | ||
| in | ||
| { | ||
| packages.${system} = { | ||
| default = buildPackage { | ||
| x11 = true; | ||
| wayland = true; | ||
| }; | ||
| wayland = buildPackage { | ||
| x11 = false; | ||
| wayland = true; | ||
| }; | ||
| x11 = buildPackage { | ||
| x11 = true; | ||
| wayland = false; | ||
| }; | ||
| }; | ||
|
|
||
| homeManagerModule = | ||
| { | ||
| config, | ||
| lib, | ||
| pkgs, | ||
| ... | ||
| }: | ||
| let | ||
| cfg = config.programs.snippy; | ||
| in | ||
| { | ||
| options.programs.snippy = { | ||
| enable = lib.mkEnableOption "Whether to enable snippy snippets manager."; | ||
|
|
||
| enableWayland = lib.mkOption { | ||
| type = lib.types.bool; | ||
| default = true; | ||
| description = "Enable wayland support"; | ||
| }; | ||
|
|
||
| enableX11 = lib.mkOption { | ||
| type = lib.types.bool; | ||
| default = true; | ||
| description = "Enable x11 support"; | ||
| }; | ||
|
|
||
| package = lib.mkOption { | ||
| type = lib.types.package; | ||
| default = | ||
| let | ||
| selectedPackage = { | ||
| "true-false" = self.packages.${pkgs.system}.wayland; | ||
| "false-true" = self.packages.${pkgs.system}.x11; | ||
| "true-true" = self.packages.${pkgs.system}.default; | ||
| "false-false" = self.packages.${pkgs.system}.default; | ||
| }; | ||
| key = "${lib.boolToString cfg.enableWayland}-${lib.boolToString cfg.enableX11}"; | ||
| in | ||
| selectedPackage.${key}; | ||
|
|
||
| description = "Snippy package to install. Defaults to wayland + x11 support"; | ||
| }; | ||
| }; | ||
|
|
||
| config = lib.mkIf cfg.enable { | ||
| home.packages = [ cfg.package ]; | ||
| }; | ||
| }; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| nixpkgs ? import <nixpkgs> { }, | ||
| }: | ||
| with nixpkgs; | ||
| mkShell { | ||
| packages = with nixpkgs; [ | ||
| shellcheck | ||
| uv | ||
| python3 | ||
| rustup | ||
| zizmor | ||
| rumdl | ||
| typos | ||
| prek | ||
| ]; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are all dev deps, used only with
pre-commitorprekto contribute to the project