From 1f3f080d272023f4154779220976d8b43b1086d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Gro=C3=9Fmann?= Date: Sun, 8 Oct 2023 15:17:31 +0200 Subject: [PATCH] feat: added second template for pwn --- flake.nix | 4 ++ pwn-ld/.envrc | 3 ++ pwn-ld/devshell.nix | 24 ++++++++++ pwn-ld/flake.lock | 112 ++++++++++++++++++++++++++++++++++++++++++++ pwn-ld/flake.nix | 21 +++++++++ pwn/devshell.nix | 8 ---- 6 files changed, 164 insertions(+), 8 deletions(-) create mode 100644 pwn-ld/.envrc create mode 100644 pwn-ld/devshell.nix create mode 100644 pwn-ld/flake.lock create mode 100644 pwn-ld/flake.nix diff --git a/flake.nix b/flake.nix index 2a827bc..5a7e9df 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,10 @@ path = ./pwn; description = "My pwn flake template"; }; + pwn-ld = { + path = ./pwn-ld; + description = "template for loading libc in current folder"; + }; }; }; } diff --git a/pwn-ld/.envrc b/pwn-ld/.envrc new file mode 100644 index 0000000..8588604 --- /dev/null +++ b/pwn-ld/.envrc @@ -0,0 +1,3 @@ +nix_direnv_watch_file ./devshell.nix +source_up_if_exists +use flake . diff --git a/pwn-ld/devshell.nix b/pwn-ld/devshell.nix new file mode 100644 index 0000000..93e63e2 --- /dev/null +++ b/pwn-ld/devshell.nix @@ -0,0 +1,24 @@ +{ + nixpkgs, + devshell, + ... +}: system: let + pkgs = import nixpkgs { + inherit system; + overlays = [devshell.overlays.default]; + }; + shell = with pkgs; { + name = "devshell template"; + env = [ + { + name = "NIX_LD"; + eval = "$PWD/ld-linux-x86-64.so.2"; + } + { + name = "NIX_LD_LIBRARY_PATH"; + eval = "$PWD/:\${NIX_LD_LIBRARY_PATH-""}"; + } + ]; + }; +in + pkgs.devshell.mkShell shell diff --git a/pwn-ld/flake.lock b/pwn-ld/flake.lock new file mode 100644 index 0000000..45f8602 --- /dev/null +++ b/pwn-ld/flake.lock @@ -0,0 +1,112 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1695973661, + "narHash": "sha256-BP2H4c42GThPIhERtTpV1yCtwQHYHEKdRu7pjrmQAwo=", + "owner": "numtide", + "repo": "devshell", + "rev": "cd4e2fda3150dd2f689caeac07b7f47df5197c31", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1677383253, + "narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9952d6bc395f5841262b006fbace8dd7e143b634", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1696604326, + "narHash": "sha256-YXUNI0kLEcI5g8lqGMb0nh67fY9f2YoJsILafh6zlMo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "87828a0e03d1418e848d3dd3f3014a632e4a4f64", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/pwn-ld/flake.nix b/pwn-ld/flake.nix new file mode 100644 index 0000000..38ab3a8 --- /dev/null +++ b/pwn-ld/flake.nix @@ -0,0 +1,21 @@ +{ + description = "Patrick tolles flake template"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + devshell.url = "github:numtide/devshell"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + devshell, + } @ inputs: + flake-utils.lib.eachDefaultSystem ( + system: { + devShell = import ./devshell.nix inputs system; + } + ); +} diff --git a/pwn/devshell.nix b/pwn/devshell.nix index c03bd3a..ced6115 100644 --- a/pwn/devshell.nix +++ b/pwn/devshell.nix @@ -30,14 +30,6 @@ ]; env = [ - { - name = "NIX_LD"; - eval = "$PRJ_ROOT/ld-linux-x86-64.so.2"; - } - { - name = "NIX_LD_LIBRARY_PATH"; - eval = "$PRJ_ROOT"; - } ]; }; in